Transactional concern about Sagas


We are looking to integrate this great framework in our project, but we have one concern about Saga Transactions.
We need to know if we could scale horizontally our Sagas without risking to have two processes trying to handle the same event at the same time.

I saw on an old post (2015) you mentioned that the saga manager and the event handler share the same transaction.
How could this work in a concurrent environment without having to declare a SERIALIZABLE isolation level ?

Dank je

Hi Laurent,

the fact that Event Handlers and Saga Manager handle events in the same transaction is only valid if they are also processed by the same thread. In Axon 3, this is only possible with SubscribingProcessors. TrackingProcessors always run in their own Thread(s) and will always manage separate transactions.

Currently, the only way to scale Sagas horizontally is by ensuring an Event is only handled on one node (either by only having one active node, or by using competing consumers on a queue). This is not an ideal situation, but it works for now. In the meantime, some contributors are already working on a distributed implementation for Sagas.