I am trying to make a sequence diagram for Axon workflow. However, I am not sure what's the event processing order. Does Axon save events in the Event Store first, or does it publish the events on the Event Bus first?
What might be curious to know is that from Axon's perspective, the EventStore
is a more specific implementation of an EventBus
. You can see this when looking at the AbstractEventStore
implementation, which extends the AbstractEventBus
implementation.
The operation to publish will group the events into a single transaction. Or, in Axon terms, the UnitOfWork
. Before doing anything with it, it'll invoke the prepareCommit
method to prepare the transaction/UnitOfWork for committing. It is here that Axon invokes SubscribingEventProcessors
and stores events.
However, storing events happens first, and providing events to the Subscribing Processors comes later. From that perspective, you can state that storing in the EventStore
comes first, and publishing on the EventBus
comes second.