I’ve a requirement to rollback to the n-1st version of the event sourced aggregate upon reception of reject command. I’m using spring boot to bring up axon engine. I’ve searched the group and found few relevant discussions but there is no sample code snippet to implement this. Please take me to the axon class/document explaining it - thanks.
@Aggregate
public class Document {
@AggregateIdentifier
private String id;
private String content.
…
@CommandHandler
public void reject(RejectCommand command) {
apply(RejectEvent.id(command.id).build);
}
…
@EventSourcingHandler
public void on(RejectEvent event) {
// Rollback to n-1st version of this aggregate.
// this.content = howToRetrieve(n-1).content ???
}
}
Cheers, Rajesh