I’ve stumbled upon an issue when tracking events from multiple aggregates in a single read projection.
My config (mostly defaults, running on single node):
Spring Boot 2.0.3
- Aggregate A receives a command and applies an event E(A) at time T0. However, before returning from the command handler a delay is introduced (Thread.sleep).
- While the above thread is still sleeping, aggregate B receives a command and applies event E(B) at time T1.
- The command handler in aggregate B returns.
- The read projection P event handler method for E(B) is called.
- The command handler in aggregate A returns.
- The read projection P event handler method for E(A) is never called.
The order of the events stored in mongo is:
- E(B), timestamp = T1
- E(A), timestamp = T0
If I delete the tracking token and restart the application the event handlers in P are called in the timestamp order:
- P: E(A)
- P: E(B)
Any help or guidance would be greatly appreciated.