How to listen Entity Extension written event? - shopware6

Currently, I can see the entity extension data in request body but it is not included in product written event payload.
Is it possible to listen entity extension written event?

Every entity in shopware should dispatch a written event when it's saved.
So like product.written when a product is saved, there should also be a similar event when your entity is written. It should be triggered automatically, and it's your_entity_name.written.

Related

How to subscribe to Topic in Dapr for .Net Core outside Controllers

I just started with Dapr a few days back and although I am able to publish and subscribe to events in Dapr, the way I am doing so is using the Topic method attribute on an action method within a controller such as this...
And while this works I prefer not to mix integration events with service API. This is the Swagger...
I get that the topic name is long but it's so I can ensure unique topics.
What I'd prefer is to position the Handler outside of any Controller. Something like this..
Is this even possible?
I derived a solution out of the .Net Dapr client routing sample.
For each event I add a MapPost endpoint similar to the following
The RequestDelegator receives the event for a given Topic, it will resolve the handler class from the interface and topic attributes and then invoke it's handle method, passing in the event data from Dapr.
My services follow the CQRS and EventSourcing patterns, as such integration events will rarely be the same shape as the command inputs. In my case, events are typically much lighter than a commands, consisting of mostly related Ids.

Where should I put service components while using Redux?

In my app I got service classes like SpeechRecognizer, VoiceRecorder ...
I wonder should I put them into the state of application, my personal opinion that they don't form the state, so then where to put them.
Also to notice, SpeechRecognizer is initialized with callbacks that are called when certain event occurs, so who shall subscribe to them and how to implement that subscription ?

Side effects in Fluxible?

Here's what I'm trying to do---add a listener to a fluxible event to do an ajax call. In Redux, this is called a side effect and there are several ways of doing this (ex: create "side effects" using redux-saga, which are just listeners that do stuff). In Flux, one approach is to do side effects in the Store.
What about fluxible?
From what I can tell, the way to do this is in the Store. But I don't see a way to get the context. So perhaps there's another way to do this?
You should do ajax call in action. Action receives context, where you could provide plugin to do http call. Stores should contain only application state and have only synchronous code.

Intercepting object creation in RavenDb

I am trying to run some code on objects that are loaded from RavenDB, and I need to do it just after the object has been loaded with its property values.
I've tried intercepting the deserialization process using a CustomCreationConverter and overriding ReadJson, but the object I can access at that point has all the properties set, except the one I need : the Id. Is there somewhere else I can slot into the pipeline in order to do this?
The reason you don't see the Id is because it's not part of the document, it's in the metadata as #id.
If you want to intercept client side, you can register a custom Conversion Listener. Create a class that implements IDocumentConversionListener and register it with documentStore.RegisterListener(). In the DocumentToEntity method, you can run your custom logic. The documentation is lacking on Listeners in general, but there is another topic that also uses them:
http://ravendb.net/kb/16/using-optimistic-concurrency-in-real-world-scenarios
The other option would be to add a bundle that intercepts on the server side. For that, you would use a Read Trigger.

Service or event?

What is the best way to go about calling various services that are internally only (i.e. no client code can invoke the logic)?
IProcessService - will run various things and make changes to a domain entity, however when certain data changes on this domain entity we want to send out a notification (add a new record to notification table, record the current user and type of notification, and maybe even send out email).
E.g. Add a client, as soon as we add a client - we want to save a record in the db that a client has been added, if we have a supplier confirmed, we have a delivery date confirmed we want to fire off notifications.
My notifications are a way of logging all activity related to the process of a Order...
Is using a pub sub approach common/ event listers etc?
NOTE: I am using Linq To Sql, and a service layer to communicate with my asp.net mvc app, all my business logic/validation/rules etc reside inside my service layer...
Check out Domain Events.
When you call client.ConfirmDeliveryDate(), it would raise a domain event (DeliveryDateConfirmed). You'd then have a class listening to this event: EmailCustomerWhenDeliveryDateConfirmed.