how can we retry the execution of a command handler method in case of failure instead of triggering the compensation logic immediately?
public CommandHandlers commandHandlerDefinitions() {
return SagaCommandHandlersBuilder.fromChannel("CHANNEL_NAME")
.onMessage(Command.class, this::handleCommand)
.build();
}
public Message handleCommand(final CommandMessage<Command> command) {
try {
//logic
return withSuccess();
} catch (Exception e) {
// in case of failure, I want to retry the method instead of directly triggering the compensations action
return withFailure(SagaError.of(e));
}
Hi,
how can we retry the execution of a command handler method in case of failure instead of triggering the compensation logic immediately?