We’ve run into a situation where multiple threads are publishing events for the same aggregate into the EventBus.
This has caused a bit of a problem where one UnitOfWork can contain multiple events (E1, E2, E3), and at the same time, another thread publishes an event for the same aggregate (E10).
Ideally I would like: E1, E2, E3, E10 - but instead we get (as an example) E1, E10, E2, E3.
We’re using the DisruptorCommandBus, is it safe to assume that calls to EventBusTerminal’s publish() will always contain at least all the events for one UnitOfWork?
If so, I think I should be able to put a simple semaphore around the cluster.publish() loop when there is more than one EventMessage?