Subscription query - block in Rest Controller on specific projection version


As we are switching the event handling in our application more and more towards tracking event processors but still have a UI that expects a synchronous REST api I was looking into the following example:
However this example does not take into account concurrent updates on a projection (the first update on the projection could be triggered by an action of another user and as a consequence the call might return too soon).

One way this could be done is by having the new version number of the aggregate being returned after the command is processed. I could then block until the projection is updated with at least that version number or a higher one.
Is there a “supported” way to get this version number (as a CommandResultMessage)?


Hi Robin,

you can get the current version of an Aggregate by calling the AggregateLifecycle.getVersion(). For an event sourced aggregate, this is basically the sequence number of the event that was last applied to it. You can return this value as part of your Command’s result.

We do have plans to implement this as a standard feature, where we always return the version of the aggregate as a Command’s response. This feature hasn’t been concretely planned, though.

Kind regards,

I will try to implement this scenario by filtering query updates by request id