axon cqrs without event sourcing

Hi,

I am evaluating the framework for one of the application that I am working on. I want to use the CQRS but I don’t want to use the event sourcing for data storage.
I know that one approach is to mark the aggregate as an entity.

Is there an alternative there. Can I just plug-in my custom repository which would create the aggregate from my own entity classes and stop axon from persisting the events. I want to use an event handler which would update the data in the database based on the event.

Thanks.

Hi Pankaj,

if you don’t want to use event sourcing, you can mark your aggregate as an @Entity (as well as @Aggregate) and use the GenericJpaRepository. When using Spring Boot, assuming your aggregate is called “MyAggregate”, if you name that repository bean myAggregateRepository, it will automatically use that. Alternatively, you can specify the name of the repository bean in the @Aggregate annotation.

The Axon Spring Boot starter will also automatically give you an Event Store. If you don’t want to store your events, specify an EventBus instance in your application context to override that behavior.

Cheers,

Allard