eventuate-tram / eventuate-tram-sagas

Sagas for microservices
Other
1k stars 228 forks source link

In case of unhandled exception Eventuate tram Saga gets blocked #72

Open SURBHI-06 opened 2 years ago

SURBHI-06 commented 2 years ago

To replicate the issue below are process:- We are connecting 3 services in Saga flow while executing the saga we are facing some unhandled exceptions, which can't be handled by try-catch.

  1. try to trigger the negative case by payload, by sending an improper message in Kafka to the command handler eg:-
  1. After executing the failure case, we can't execute the positive case or any case as it will not allow running the flow due to eventuate being blocked.

Please refer example

public Message reserveCredit(CommandMessage<ReserveCreditCommand> cm) {
    ReserveCreditCommand cmd = cm.getCommand();
    long customerId = cmd.getCustomerId();
    Customer customer = customerDao.findById(customerId);
    // TODO null check
    try {
      customer.reserveCredit(cmd.getOrderId(), cmd.getOrderTotal()); //An Unhandled exception occurs here.
      return withSuccess(new CustomerCreditReserved());
    } catch (CustomerCreditLimitExceededException e) {
      return withFailure(new CustomerCreditReservationFailed());
    }
  }

@cer @dartartem We are looking for a resolution for these kinds of cases when exceptions are not caught inside command handles and Saga got blocked as a result.

Please refer to "Health check endpoint" in the below doc

https://eventuate.io/docs/manual/eventuate-tram/latest/cdc-configuration.html