I am using the Axon Framework without the Axon Server with spring-boot auto config. My question is: If i am running a saga process as you can see below, and in the middle in processing i run out of disk, there will be an exception, and i have to rollback. How can I do that? How much i have to roll back?
My saga_entry table will be this:
SAGA_ID: 22ad255b-4378-4bb4-84c2-061ca666c6e7, REVISION: null, SAGA_TYPE: hu.saga.account.SagaAccount, SERIALIZED_SAGA: 3c68752e6d6f6c617269732e736167612e6163636f756e742e536167614163636f756e742f3e
My association_value_entry table will be this:
ID: 2, ASSOCIATION_KEY: accountId, ASSOCIATION_VALUE: 11, SAGA_ID: 22ad255b-4378-4bb4-84c2-061ca666c6e7, SAGA_TYPE: hu.saga.account.SagaAccount
And in my domain_event_entry table will be only two events (not 3 as it should be) AccountCreatedEvent, MoneyWithdrawnEvent with the aggregate id: 11 .
This is just an example, may main question is what is the best way to handle and implement a rollback in Axon Saga?
@StartSaga
@SagaEventHandler(associationProperty = "accountId")
public void handle(AccountCreatedEvent event){
logger.info("Saga Start");
commandGateway.send(new WithdrawMoneyCommand(event.getAccountId(), event.getAccountId(),event.getOverDraftLimit()));
}
I write null to imitate a potential rollback in the DepositMoneyCommand constructor
@SagaEventHandler(associationProperty = "accountId")
public void handle(MoneyWithdrawnEvent event){
commandGateway.send(new DepositMoneyCommand(null,event.getTransactionId(),event.getAmount()));
}
@EndSaga
@SagaEventHandler(associationProperty = "accountId")
public void handle(MoneyDepositedEvent event){
logger.info("Saga End");
}
I mean if i dont handle it the saga tables will not be empty as it should be, and i cant fire an other saga for that aggregate id: 11, because its already exists in the domain_event-entry table
How can I delete from the domain_event_entry table? AggregateLifecycle.markdeleted() not working for me.