Temporal querying is not build in to the framework and as such this would require a purpose build Query Handling Component that likely connects to the Event Store to retrieve the event up to a given time frame to rebuild the model.
To build something like this, I’d suggest you create a Query Model which you want to recreate up to a given state.
This model should be capable of handling events to adjust it’s own state.
From there, you can add a Query Handling Component which will handle the temporal query you have, likely containing some identifiers and the time frame you’re interested in.
That component will have a dependency on the Event Store to retrieve a stream events, which it can replay against your “Event Handling Query Model”.
To perform the latter, it’s easiest to wrap a fresh instance of your model in a
The AnnotationEventHandlerAdapter has a
handle(EventMessage) method, so that it can handle the stream of events.
Lastly, the component creating the AnnotationEventHandlerAdapter and providing the event stream to it should have the smarts to cut of the stream at a given point in time.
So, it’s some self work at the moment, but shouldn’t be to hard.
Final note though.
This approach will mean that on an increase of you Event Store, this operation will take longer and longer.
Optimizing this wholly depends on the number of events you need to replay against your Query Model, something which is hard to deduce upfront.
That’s my two cents to the situation.