diff --git a/src/main/java/com/modoospace/config/rabbitmq/errorhandler/CustomErrorHandler.java b/src/main/java/com/modoospace/config/rabbitmq/errorhandler/CustomErrorHandler.java index 509a435..4a40aca 100644 --- a/src/main/java/com/modoospace/config/rabbitmq/errorhandler/CustomErrorHandler.java +++ b/src/main/java/com/modoospace/config/rabbitmq/errorhandler/CustomErrorHandler.java @@ -4,6 +4,7 @@ import org.springframework.amqp.AmqpRejectAndDontRequeueException; import org.springframework.amqp.ImmediateAcknowledgeAmqpException; import org.springframework.amqp.rabbit.listener.FatalExceptionStrategy; +import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException; import org.springframework.util.ErrorHandler; @RequiredArgsConstructor @@ -13,7 +14,7 @@ public class CustomErrorHandler implements ErrorHandler { @Override public void handleError(Throwable t) { - if (this.exceptionStrategy.isFatal(t)) { + if (this.exceptionStrategy.isFatal(t) && t instanceof ListenerExecutionFailedException) { throw new ImmediateAcknowledgeAmqpException( "Fatal exception encountered. Retry is futile: " + t.getMessage(), t); }