Re: [axonframework] Aggregate Root Event Ordering

56 views
Skip to first unread message

Allard Buijze

unread,
Jan 29, 2015, 11:14:01 AM1/29/15
to Axon Framework Users
Hi Carlyle,

the answer is no ;-). Axon will only guarantee that the order in which an aggregate produces events, is also the order in which they are published. The actual transportation system you use is responsible for ensuring messages are delivered in the order they were published. The SimpleCommandBus handles events immediately, so order is guaranteed. If you use AMQP or JMS, you should also be ok, since most brokers will have that behavior (as long as message processing doesn't fail).

Otherwise, each event will always contain a sequence number. Worst case, you could use that sequence number to re-order messages on the recieving side. Before you spend time building that, check your message broker's documentation on message order guarantees.

Cheers,

Allard

On Wed, Jan 28, 2015 at 6:36 AM, Carlyle Davis <carlyl...@gmail.com> wrote:
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 order is guaranteed.  For instance I have an aggregate root that can have actions that create, modify, and delete 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 a JVM (processed is a different question)

A simple use case is shirt ordering where a user buys a shirt and then changes the color and then confirms the order which prevents further change.

psuedo Code

new Order( new Shirt() )

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages