We are using AxonFramework 3.1.1 with Spring Boot 1.5.16.
I would like to retrieve events from EventStore to resend them (through different channels then usually) in case of infrastructure problems or bugs.
We are not using event sourcing, but our aggregates’ state is stored twice:
in JPA repository per aggregate (with @Aggregate(repository = “myAggregateRepository”) where myAggregateRepository is GenericJpaRepository)
using JpaEventStorageEngine, as list of events in domain_event_entry DB table.
We are using axon-spring-boot-starter to simplify configuration so I simply inject EventStore when I am trying to retrieve events from EventStore like this:
DomainEventStream domainEventStream = eventStore.readEvents('5e9fdeff-acfc-40a0-8e7c-074a733240e8'); EventMessage<?> eventMessage = domainEventStream.next();
However, it is failing with “java.util.NoSuchElementException: No value present” in EventUtils when trying to construct GenericDomainEventMessage, because AggregateType is null. It is indeed not set in database.
java.util.NoSuchElementException: No value present
I understand that AggregateType is not set, because we have aggregate repository implemented with GenericJpaRespository and event is stored in DB with AggregateType set to null.
Is there any other way to retrieve event from the database with this type of configuration (when AggregateType is not set)? Another solution would be to store AggregateType - is it possible to configure Axon to do that without event sourcing?