We have several projects using Axon that share a DB schema. We want to avoid that different projects all write their events in the same event table unfortunately these tables are hardcoded in the DefaultEventEntryStore. We fixed the problem by creating different tables that we refer to with an alias defined per DB user. That way we have different physical tables but they appear as DomainEventEntry to the application.
Since I don’t think this approach is ideal and may not work for everyone I made a few small changes to the DefaultEventEntryStore that allow you to define your own eventEntry classes (and tables). This example uses reflections to create new instances but this could easily be replaced by actual constructors/factories for performance reasons.
I don’t like making changes to framework code because it adds the overhead of maintaining these changes whenever the framework changes so for us the alias solution is best but I included this solution as it may help others.
To use it I made a few changes in the spring config:service.bits.kernel.infra.persistence org.axonframework.saga.repository.jpa ...
CustomEventEntryStore.java (18 KB)