Event Sourcing Repository


I am a new to axon and was exploring different aspects of it.

Can someone please help me understanding how the EventSourcingRepository is used to reconstruct the state of an aggregate.

A sample code would be very helpful.

Thanks in advance!!


I’m not sure what you mean.
When calling Repository.load(…), you get an Aggregate instance which wraps your class (the generic T). You can then cal invoke() or execute() on it to execute logic.

Generally, however, you will not even need to use an EventSourcingRepository directly, as Axon can take care of loading aggregates for you. Just register your aggregate in the Configurer or, when using Spring, annotated with @Aggregate.