Hi,
We had a rather interesting problem today. Although we managed to solve it in another way, I would like to have some input on how to resolve this in general.
We have an event handler responsible for sending mails. In order to send those mails, the handler requires a certain projection (a read model). Said projection is managed by another event handler. Both event handlers are tracking and - as one depends on the other - in the same processing group ordered with Spring’s @Order annotation. So far so good.
As the system is already in production, we have the requirement that the new component should not send mails for those older events. So we used the createHeadToken method for the initial token of the processor. However, this led to a problem. While the mail handler should not handle those older events, the projection managing handler definitely has to. Otherwise we risk that the projection is be incomplete. So our only solution (as far as we could see) was to start with the head token and then - immediately - restart the processing group by resetting the token to the beginning of the event stream (the mail handler was of course annotated with @DisallowReplay). Rather cumbersome.
So our question is: Is there a better solution for such a scenario? Is it maybe possible to start the new event processor in replay mode?
Thank you and best regards
Nils