Ultimate consistency between aggregate roots in the same limited context using aka saga process manager

Suppose you have two aggregates in a limited context that have some limitations among themselves. Using DDD, these intergroup constraints cannot be applied in the same transaction, that is, cumulative boundaries are transaction boundaries.

Could you use what Microsoft CQRS calls a โ€œprocess managerโ€ in a journey to coordinate two aggregates in the same restricted context, or is it a process manager that is used only for coordination between two limited contexts? What would be the equivalent of a process manager who coordinates two or more aggregate roots in the same limited context?

+6
source share
1 answer

The aggregated root defines a restricted context by default, although at a lower level (btw the lower level of the restricted context that you can find is an object, any object). The process manager is the name that they used instead of the saga, perhaps you can come up with other names, it does not matter, they all have the same purpose.

And yes, I would consider using a saga to achieve the final sequence. In fact, I think this is the best way, and that is exactly what I do in my applications. In any case, I use a message-driven architecture (yes, in a local, non-distributed application), and I have automatic support for the saga through the service bus (mine, not yet released).

It is important to deal with possible consistency in order to ensure idempotency everywhere. That is, the aggregate roots must reject the duplicated operation, and, of course, the event handler must be able to cope with the fact that the same event can be published more than once. However, keep in mind that you cannot guarantee 100% idempotency, but you can come close to it.

+9
source

All Articles