1
votes

I am building a web application where I need to track some event like sms send, delivered, or failed.For that I want to use Axonframework . I have followed axonframework tutorial on official website and also from this website

but I didn't find any solution to fetch events from daomainevententry table created by Axon itself. I am using Java language, Spring framework and MySql database for complete development of my application.

Kindly tell me any good tutorial or solution for that.

1

1 Answers

2
votes

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 DomainEventEntryto 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 DomainEventEntryand look for interesting fields.

Hope this helps,

Simon