Quantcast
Channel: handlers – 100% Private Proxies – Fast, Anonymous, Quality, Unlimited USA Private Proxy!
Viewing all articles
Browse latest Browse all 10

How to handle Domain Event handlers ordering

$
0
0

Background:

  • we have 2 bounded context: Inventory and Sale
  • application context is Point-of-sale system

Scenario:

When a Checkout happen on Sale BC, we would like to decrease quantity in Inventory.

Problem:

We have 2 handlers in this problem that is interested in Checkout or PurchaseCreated event:

  • The handler from Inventory that will decrease quantity of a Product
  • The handler for a Projection that creates denormalized view.

In a synchronous environment like PHP, I can just the right order of the Event listeners.

I would like to know how this is handled in an asynchronous environment?

I would appreciate if the answer is not technology specific because then at least many of us will benefit from the answer.

Why:

The Checkout event only contains (in simplest form):

  • Date of transaction
  • Product infos (id, name, quantity bought, and current price).

The projection for reporting shows what products are bought and quantity left and total sale.

The order of Event handler is important for the Projection to be accurate. The denormalized view contains data not in the Checkout event which is the “stock quantity”.

If the Projection queries the Inventory first, it can subtract the stock quantity to the quantity bought

BUT

If the Inventory handler comes first, it would be inaccurate if stock quantity would be subtracted from quantity bought.

The post How to handle Domain Event handlers ordering appeared first on 100% Private Proxies - Fast, Anonymous, Quality, Unlimited USA Private Proxy!.


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>