About the unknown exception saga will be in a suspended state.
isfong opened this issue · 2 comments
In the saga execution process, an exception is intentionally thrown somewhere, and it is not caught. For example, if the input value is not equal to 1, an exception is thrown. At this time, the entire saga will be in a suspended state. It will never be available unless the entire service is restarted.
Continuously initiate operation requests to the saga,the console only output logs:
[nio-8083-exec-5] i.e.t.s.o.SagaInstanceRepositoryJdbc : Saving com.example.ftgo.orders.application.sagas.cancel.OrderCancelSaga 000001732876e3fb-e0d55e4d5ab20000
[nio-8083-exec-5] i.e.t.s.o.SagaInstanceRepositoryJdbc : Updating com.example.ftgo.orders.application.sagas.cancel.OrderCancelSaga 000001732876e3fb-e0d55e4d5ab20000
Please help me, I am just a novice.
Although the input value is correct later, no exception will be triggered, but the whole saga is still in a suspended state.
I started saga like this:
public OrderValue cancel( Long id ) {
Orders order = this.orderRepository.findById( id )
.orElseThrow( ( ) -> new OrderNotFoundException( id ) );
OrderCancelSagaData orderCancelSagaData = new OrderCancelSagaData( order.getConsumerId( ), order.getId( ), order.getOrderTotal( ) );
this.sagaInstanceFactory.create( this.orderCancelSaga, orderCancelSagaData );
return order.value( );
}
Hi,
this may be connected with:
- Saga (CreateOrder) - compensation transactions of earlier steps are not executed #107
- Attempt to revise a cancelled order breaks the system - and all subsequently created orders are broken #70
As issue #107 describes, unhandled exception in CommandHandler or in domain service method or in Aggregate method will break the Saga.
In issue #70 an exception
"org.springframework.orm.jpa.JpaSystemException: Transaction was marked for rollback only; cannot commit; nested exception is org.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit"
breaks not only the current Saga, but all the future Sagas as well. Only full system restart helps.
BTW, what do you mean about suspended state of the Saga, how do you check this state?