if you are using JpaEventStorageEngine
(e.g. you have spring-data-jpa
on your classpath and configured a JPA persistence unit using application.properties
or application.yml
), Axon is using the Entity DomainEventEntry
to store the events. In your database these results in entries in the table DOMAIN_EVENT_ENTRY
or something similiar.
To access it from Spring, you could use Spring-Data yourself. Define a Spring-Data Repository:
import org.axonframework.eventsourcing.eventstore.jpa.DomainEventEntry;
import org.springframework.data.jpa.repository.JpaRepository;
public interface DomainEventRepository extends JpaRepository<DomainEventEntry, Long> {
}
By doing so you will get default access methods to query from this repository. For further customization you can write additional methods. Please consult the documentation of Spring Data on how to do so.
Probably you are interested in querying for events for a certain aggregate:
List<DomainEventEntry> findByAggregateIdentifier(String aggregateIdentifier);
or by specific type:
List<DomainEventEntry> findByType(String type);
To explore more, just navigate the hierachy of the DomainEventEntry
and look for interesting fields.
Hope this helps,
Simon