Get object at specific date by replaying events

72 views
Skip to first unread message

Conehead

unread,
Mar 2, 2015, 6:50:17 AM3/2/15
to axonfr...@googlegroups.com
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!

Allard Buijze

unread,
Mar 2, 2015, 7:07:51 AM3/2/15
to Axon Framework Users
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

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages