What are the sequence outages in the event handler?

First of all, let me say that I am new to sharing responsibility between requests for requests and organizing events (Message-Drive architecture), but I already see some significant design advantages. However, there are a few more issues on which I am unclear.

Say I have a class Customer(aggregated root) that contains a property postalAddress(an instance of a class Addressthat is an object of value). I also have a class Order(another aggregate root) that contains (among OrderItemobjects and other things) a property called deliveryAddress(also an instance of the class Address) and a string property called status,

The customer submits the order, invoking the command PlaceOrderthat triggers the event OrderReceived. At the moment, the status of the order "RECEIVED". When the order is dispatched, someone in the warehouse issues a command ShipOrderthat fires the event OrderShipped. At the moment, the status of the order "SHIPPED".

One of the business rules is that if it Customerupdates them postalAddressbefore the order is sent (i.e. while the status is still "RECEIVED"), the deliveryAddressobject Ordermust also be updated. If the status Orderalready was "SHIPPED", deliveryAddressit was not updated.

Question 1. What is the best place to place this "cascading address update" in the saga (aka, process manager)? I think so, given that he is translating the event ("The client just updated his mailing address ...") to the team ("... so update the delivery address of the order 123").

Question 2. If the saga is the right tool for the job, how does it identify orders belonging to the user, given that the unit can only be obtained using a unique identifier (in my case, UUID)?

, , , , Customer postalAddress ( CustomerAddressUpdated, ), OrderDeliveryAddressUpdated (.. ), .

3. "" ?

+4
1

, , . , :

?

. OrderProcess.

OrderProcess , id?

- , . , -- shuttle-recall IKeyStore, AR, , - [order-process]:customerId=CID-123; .

"" ?

, . - Amazon, , , . , , , ( ) .

, , . , , .

:)

+3

Source: https://habr.com/ru/post/1619759/


All Articles