Skip to content

Commit

Permalink
refactor: ListenerExecutionFailedException 조건 수정
Browse files Browse the repository at this point in the history
- 메시지 처리 도중 발생한 치명적 예외만 ImmediateAcknowledgeAmqpException를 던진다.

Related: #70
  • Loading branch information
hoa0217 committed Apr 17, 2024
1 parent 60e7f7a commit 23041d4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit 23041d4

Please sign in to comment.