A Saga in Axon terms is nothing more than a specific type of Event Handler.
As such, Axon will use an Event Processor to give a Saga instance its events.
Event Processors come in two flavors:
SubscribingEventProcessor
TrackingEventProcessor
You should describe a subscribing processor as "receiving the events from the EventBus
within the same JVM".
A tracking processor should be described as "pulling events from the EventStore
, keeping track of the progress through as shareable token.
The nature of your question now highly depends on which Event Processor is being used.
With a SubscribingEventProcessor
you would by definition not share the event load between different instances of the same app.
Thus, a given Saga would be loaded on any live instance, given both receive events associated to the same saga.
Needless to say, using the subscribing processor for Sagas does no work well if you are going to distributed the application running those Saga instances.
Instead, it is highly recommended to use a TrackingEventProcessor
to be the source of events for a specific Saga instance.
In doing so, any load sharing follows from the requirement that a TrackingToken
must be claimed by such a processor to be able to do any work (aka, handling events).
Thus, to share the workload of providing events from the event store to your Saga instances in Axon, you would have to do the following:
- Set up a
TrackingEventProcessor
for said saga type
- Set up a
TokenStore
, where the underlying storage mechanism is shared among all app instances
- [Optional] If you want parallel processing of the event stream, you will have to segment the
TrackingToken
for the given saga type. [EDIT] On top of this, the saga_entry
table used by the SagaStore
should also be shared among among all app instances running the given Saga type
Hope this answer suffices for the "many more questions" you have @Yoann!