Get object at specific date by replaying events

Hi there!

I am quite new to the axon framework and got a little question.
Currently I have an aggregate and successfully save the events to the eventstore.

Now I am looking for a way to reconstruct that aggregate at a specific date/time.
I only need to be able to view it, editing is not necessary.

Can I achieve this with an ReplayCluster?
Where should I start to look for infos?

Thanks!

Hi,

reconstructing an aggregate to view data is bad practice. I suspect you wish to reconstruct a specific view model as it was at a specific moment in time?

There are several ways to achieve this. One way is to use an EventVisitor that visits all events stored in the Event Store and processed all events prior to a certain date/time. If you are sure the events all belong to the same aggregate, you can also use loadEvents() to load events for a single aggregate.

The other way is using a ReplayCluster. However, the ReplayCluster is designed to do a full rebuild of a view model. There are EventStore wrappers (see TimestampCutoffReadonlyEventStore) that will help you prevent reading events after a specific date/time.

Whether you choose one approach or another, is mainly whether this is functionality you want to use operationally (go for option 1), or incidentally (both options possible).

Hope this helps.
Cheers,

Allard