Correct Way for Replaying Events

Hi all,

I can not see in the actual documentation what is the proper way to replay all event of an EventStore
to its listeners. From what I understood EventStore are populated by Repositories from Aggregates.
Then Repositories fire event to event buses.

My [noob] question is what is the way to replay events from one EventStore to a set of EventHandler through
an EventBus ?

Thanks in advance :slight_smile:

Hi Epo,

the JPA Event Store has a method on it (which isn’t exposed through the EventBus api itself) which allows you to perform action based on each event in the event store. Typically, that action would be to send it to a specific (!) event handler.

Note that it is generally not a good idea to publish them via the event bus (there’s exceptions, of course). Only dispatch these replayed events to the event listeners that you want to “reset”. There is a little development involved here, but this is not an action that you’d regularly do during runtime anyway.

The FileSystem Event Store doesn’t have this method. It’s not a “full fledged” event store implementation, yet.

Cheers,

Allard

Thank you Allard,

I agree with you when you say not to replay events through the event bus and
to do this directly to the event listeners to reset.

I saw the method in JPAEventStore visitEvents it accepts an EventVisitor.
Good use of the visitor pattern … neat.

For my own project I implemented a DB4o EventStore, I will add also the visitEvents
from the EventStoreManagement interface. My project use axon as main DDD/CQRS
support.

I will let you know when the Db4oEventStore implementation will be stable enough if never you want it
in the axon core.

Cheers,