About Replaying, (r-)building views, accessing aggregates

Hi,

I try to understand the concepts the comes after the “getting started” tutorial and I’ve read the reference manual multiple times. But I have still some questions where I cannot find an answer.

I have read that to create a new view (or change an existing), the event stream “simply” has to re-played. I found an old post at https://groups.google.com/forum/#!searchin/axonframework/replay/axonframework/Azkao_xY0hE/9vA-COwWaWIJ but this is from 1.x times and replay was not supported at this time. I could not find an example in the documentation who to replay an event stream in an application. And how can one prevent things from being executed more than once (e.g. sending E-Mails based on events)?

In the same post there was the idea to access the aggregates directly if an entry in the view table is missing. But I could not find a way to access aggegates outside of a unit of work. How could I do this? And is there a kind of “list all aggregates” method?
I wonder if accessing the aggregate would really solve the problem. If I understand right, an aggregate does not require to hold all the properties an event contains (e.g. in the address book sample, “Contact” does not have a “name” field. The aggregate root only handles the business logic). So accessing the aggregate would not provide all the information that the events provides.

Thank you for your help,

Michael.

Hi Michael,

replaying in Axon is done on Clusters. A Cluster in this case is a group of event handlers that share some common characteristics. Handlers that may be replayed can be bundled together in a replaying cluster. This cluster has a replay method (check reference guide for details). How and when the replay is triggered is up to you to decide. Typically, this is part of some maintenance run.

Regarding the data in the view table, it is not the aggregate that is queried for information, but the query details are constructed by processing a selection of events (typically all events of a certain aggregate). This way, you don’t need to persist all view data, but generate it on-the-fly.

Cheers,

Allard

Hi Michael,

event listeners don’t need to implement ReplayAware. However, then they do, those listeners are notified that a replay starts. And also when it has ended.

About your remarks:
The FileSystemEventStore doesn’t support replaying because it isn’t suitable for production use anyway. It just hasn’t been worth the effort so far.

The ReplayAware is currently used in EventListeners only. However, the concept itself doesn’t have to be limited to that. Since you can use the annotation on @EventHandler annotated beans, it wouldn’t make sense to have ReplayAware extend EventListener.

Cheers,

Allard