Hey there,
I have a simple question and I am fairly certain that the answer is yes, but I would like to bounce it off the members of the forum. I have a slight concern about the order in which events are processed by EventHandlers that are running in separate JVMs and I am wondering how and if order is guaranteed. For instance I have an aggregate root that can have actions that create, modify, and confirm this aggregate. Upon change of the aggregate state events are broadcasted to various event handlers some of which are not within the same JVM. My question is, will Axon guarantee the order in which the events are spawned is the same order in which they are received by an observing JVM (processed is a different question)
A simple use case is shirt ordering where a user buys a yellow shirt and then changes the color and then confirms the order which prevents further change.
pseudo Code
new Order( new Shirt( “Yellow” ) )
-> apply( OrderCreatedEvent( “Yellow”))
Order.swapShirt( new Shirt( “Red” ))
-> apply (OrderChangedEvent( “Red” ))
Order.confirm()
-> apply( OrderConfirmedEvent )
The assumption with this use case is that these events happened after 3 separate commands were issued to the JVM. I can see that within a JVM this is fairly straightforward, these events are played in the order that they have been received, but for other nodes listening on a distributed event bus I am not sure that the order will be preserved especially if these events happen quickly. Unlike Commands that have a TargetAggretIdentifier, Events don’t have a similar aggregate locking concept. Any thoughts?
-Carlyle
P.S. Sorry for the silly example just wanted to add a bit of context.