Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would go for simpler solution - just add this information (for example in a form of <code>HasCustomerReachedMaxOrderAmount</code>) to the event that starts the Saga.</p> <p>The second option I'd choose is to prepare a read-model designed to be used with the Sagas and query data from there, but I'd gather all the required information even before the saga is started. This enrichment could be performed by a handler to the original event raised by AR as this is not something that is part of Aggregate/Bounded Context.</p> <p>In most cases however basing on data passed with events is sufficient due to the fact that Sagas should contain business logic only in form of process. This very often means that you might end up with more then one Saga (to follow your example <code>OrderSaga</code> and <code>OrderWithMaxAmountSaga</code>).</p> <p>All that said, considering the sample scenario you've provided, I think that decision whether order requires authorization or not should rather be part of your domain itself and passed while starting saga.</p> <p>I'd model this scenario like this - <code>CustomerAR</code> calculates max amount; customer places an order -> <code>OrderAR</code> is created <em>with</em> the information about max amount for this customer, <code>Order</code> verifies if it needs additional authorization -> <code>Saga</code> get started. The point is that information about max amount is important for both <code>CustomerAR</code> (where it can change) and <code>OrderAR</code> (where it's immutable). </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload