Custom Aggregate Repository

All,

I did not see an example of Axon using a different Aggregate repository other than “GenericJpaRespository” I was looking to implement a custom aggregate repository(Couchbase) ideally I would like my implementation to be on the Spring Data Repository abstraction so I could freely adjust databases. Is there any documentation or recommendations on how I can extend Axon to leverage a Spring Data repository for an aggregate?

Thanks,
Matt

Hi,

You don’t need to build a custom Repository assuming that you want to use event sourcing for your aggregates.

Just use the EventSourcingRepository and you’re set.

Rene

What is the difference between a GenericJpaRepository and an eventSourcingRepository?

The latter uses historic events to build up your aggregate’s state, while the former simply stores a single snapshot of the latest aggregate state and loads that one.

There are many advantages to event sourcing but there also are costs. Here’s a good talk on the subject: https://youtu.be/aweV9FLTZkU

Also check out some Axon tutorials, documentation or videos to see how to get started.