Sequence of Events

Hi guys,

Me again ;-).

I have the following problem:

One of my bouded contexts receives (tracking event processor) events (let’s say ExternalCreatedEvent and ExternalUpdatedEvent to make it simple) from another bounded context and issue a create and update respectively.

For certain reasons for the same aggregate id, ExternalUpdatedEvent can arrive before ExternalCreatedEvent, which of course throws an exception, because the aggregate does not exist.

Is there a way to handle that properly (except by ensuring the right sequence)?

One approach could be to let the handler for ExternalUpdatedEvent retry until the ExternalCreatedEvent is received.
But that will not work, because of the sequence of the events…

Thanks,
Markus

Looks like that external system isn’t Axon :wink:

If you get events in the wrong order in a tracking processor, there is nothing ‘simple’ you can do to re-order them.
You could ‘store’ the out-of-order events somewhere to handle them when the expected first event comes in.

If possible, try to re-sequence before they are provided to the tracking processor.

Hope this helps.
Cheers,

Allard