1
votes

I have been trying out axon recently and read lots of stuff. From what I understand, the concept of event sourcing says that system state is rebuilt from the event store, while CQRS updates a view model that can be queried with the command side side is not queryable.

  1. I will like to implement rebuilding of state myself each time the UI requests for some information. I've implemented the event processor and seen its replay capabilities. However I can't seem to find any evidence that axon allows for replays triggered on user demand. Therefore I'm asking here if its possible to personally trigger a replay to build a DAO required by the UI or axon only supports the CQRS way of doing it.

  2. When axon does a replay (when token is deleted), does it read from the snapshot table (if implemented), then from the event table or does it always start from the beginning of time?

1

1 Answers

2
votes
  1. Dropping the token manually is currently the way to go if you want your query side to be rebuilt. So, if you'd like to trigger a replay, you'd have to add a component which does that for you. This might be a tricky process as well, since you'd probably not want any other parties trying to access your view(s) while they're rebuilding. Take note that for this you do need to put your event handling components in a TrackingEventProcessor, otherwise it will have no recollection of how much of the events it has handled or not in the form of a TrackingToken.

  2. The snapshot table is meant for your aggregates to ease the loading process. When you've set up axon to use the (Caching)EventSourcingRepository, it will first load an aggregate based on a snapshot and then source the remaining events. So, to answer your second question: when you drop the token, it will read from the domain event entry table from the beginning of time.

Hope this helps!