Retrieving a list of events

Hi all,

I’m using the Axon framework without Axon server and for monitoring reasons I would like to retrieve a list of events between two timestamps. How would I go about this? I’ve seen that querying the event store directly could be bad practice, but I’m not sure how to do it otherwise.

Kind regards,

Hi @goopher, what kind of moniroting are you looking for?

I have to admit it’s not normal to query the Event Store for Events when we talk about monitoring so perhaps expanding your needs will help us to undetstand it better.


Hi Lucas,

I would just like to retrieve a list of events for an aggregate so our users can see who mutated the data that they have in front of them with what events and when that data has been updated. I have currently solved it by using a JpaRepository that checks for DomainEventEntry entities.

Hi @goopher, thanks for the answer!

You can use Axon Framework to help you on that in a form of a token. So, the EventStorageEngine has a createTokenAt method that can help you on that but it very much depend on the use case. So, extra question for you, “Is it something that will help rarely?”

  • If yes, I think its fine to have it implemented this way. You can use the EventStorage to create a Token for you on the desired start timestamp, filter out the Aggregate you want the Events for and also stop the stream at the desired end timestamp.
  • If no, I would say this is a very IO expensive operation and would argue that constructing a query model for this purpose would be the best.

Hope it clarifies a bit more my thoughts.