Allow prevention of @QueryHandlers
when the Event Handling Component backing the query handler is Replaying
#2949
Labels
Priority 3: Could
Low priority. Issues that are nice to have but have a straightforward workaround.
Type: Enhancement
Use to signal an issue enhances an already existing feature of the project.
Enhancement Description
The scenarios are plenty wherein a Message Handling Component (MHC) combines
@EventHandler
and@QueryHandler
annotated methods.The event handlers update the projection and the query handlers answers queries through the projected data.
Whenever such a MHC, or Projector, is replaying, the query handlers would likely serve stale data.
Hence, if we provide functionality that disables the query handlers from being invoked if the MHC/Projector is replaying, we would have an automatic protective measure.
Current Behaviour
Query handlers are invoked, regardless of whether the component they're in is actively replaying.
Wanted Behaviour
Users can choose whether a query handler should react to an active replay so that their behavior can be disabled for the duration of the replay.
Possible Workarounds
It is doable to implement logic yourself into the MHC that knows the replay is triggered.
This can be a plain setting for the application before start-up, through an endpoint that triggers the replay, or perhaps through a Spring profile, that lets the MHC behave differently for query handlers.
Knowing when the replay is done is tougher, requiring validation of the Streaming Event Processors progress, and once the tokens are out of their replay state, to switch the previously mentioned toggle.
The text was updated successfully, but these errors were encountered: