Domain Event Persistence and Deletion

Greetings,

Perhaps a newbie question.

I have configured a mongo-backed EventStoreEngine. I use Tracking event processors for aggregates, event handlers, and sagas, but I don’t use Event Sourcing to build the aggregate state. The aggregates are backed by domain entities I store in the DB.

So far I issue an event by applying it in the aggregate, all works well. The same event also triggers a new saga, which is persisted in a mongo-backed SagaStore.

What I see is that all issued events are stored in the domainevents collection.

I am wondering about how will these events be deleted. I don’t believe I need these events past them being triggered and fully handled.

Is this part of the framework? Should I do something special to clean-up previously processed events? Should they be kept in the DB for some other reason?

I would appreciate guidance on the matter.

Best,
Oleg

Hi Oleg,

Axon doesn’t purge messages from the event store itself. The prime use case of the Event Store is event sourcing, hence the ‘lack’ of this feature.

However, nothing stops you from removing those documents yourself. Just ensure that your tracking processors don’t need these events anymore.

Cheers,

Allard

Hi Allard,

Thank you for a quick reply! This helps.

Regards,
Oleg