How do you handle domain events?

How do you handle domain events?

The complete process looks like this:

  1. Create database transaction.
  2. Get aggregate(s).
  3. Invoke aggregate method.
  4. Add domain events to Events collections.
  5. Publish domain events and handle them.
  6. Save changes to DB and commit transaction.
  7. Publish domain events notifications and handle them.

How do you run event storming?

Steps of event storming

  1. Invite the right people.
  2. Provide unlimited modeling space.
  3. Explore the business domain.
  4. Combine with domain-driven design.

What is event storming used for?

Event storming is a workshop-based method to quickly find out what is happening in the domain of a software program. Compared to other methods it is extremely lightweight and intentionally requires no support by a computer. The result is expressed in sticky notes on a wide wall.

Are there multiple handlers for the same domain event?

There can be several handlers for the same domain event in the Application Layer, one handler can solve consistency between aggregates and another handler can publish an integration event, so other microservices can do something with it.

How to create an implementation of domain events?

On the other hand, if you use domain events, you can create a fine-grained and decoupled implementation by segregating responsibilities using this approach: Send a command (for example, CreateOrder). Receive the command in a command handler. Execute a single aggregate’s transaction.

How many times can a domain event be processed?

A domain event could be processed zero or n times, because it can be received by multiple receivers or event handlers with a different purpose for each handler. Having an open number of handlers per domain event allows you to add as many domain rules as needed, without affecting current code.

How are domain events handled in order aggregate?

When the user initiates an order, the Order Aggregate sends an OrderStarted domain event. The OrderStarted domain event is handled by the Buyer Aggregate to create a Buyer object in the ordering microservice, based on the original user info from the identity microservice (with information provided in the CreateOrder command).

https://www.youtube.com/watch?v=SbMbWmmukws