Closed
Description
Bug report
spring-amqp version: 2.1.7-RELEASE
The documentation for asynchronous @RabbitListener states:
If the async result is completed with an AmqpRejectAndDontRequeueException, the message will not be requeued.
The following example listener instead requeues the message and loops indefinitely:
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.SettableListenableFuture;
@Component
public class Listener {
@RabbitListener(queues = "example")
public ListenableFuture<Void> receive(User user) {
System.out.println(user);
SettableListenableFuture<Void> future = new SettableListenableFuture<>();
future.setException(new RuntimeException());
return future;
}
}
The problem seems to lie on the AbstractAdaptableMessageListener
. The requeue flag is true regardless of the exception type:
Moreover, not an issue for me now, but the documentation also states:
By default, the message will be requeued, unless the container’s defaultRequeueRejected property is set to false
And from the snippet above, it doesn't seem to be true either.
Metadata
Metadata
Assignees
Labels
No labels