When you have a @RabbitListener that returns a Mono or CompletableFuture, that is automatically recognized the the HandlerAdapter, an the ListenerContainer sets the AcknowledgeMode to MANUAL automatically.

It would be great if the same behaviour is true for Kotlin suspend methods.

Current Behavior

When you start the Application, there is a warning: [rabbit-simple-251] WARN o.s.a.r.l.a.MessagingMessageListenerAdapter - Container AcknowledgeMode must be MANUAL for a Mono<?> return type(or Kotlin suspend function); otherwise the container will ack the message immediately

And messages cannot be NACKed.

Context

Workaround: set the config property spring.rabbitmq.listener.simple.acknowledge-mode to manual (or spring.rabbitmq.listener.direct.acknowledge-mode, dependend on what you are using.

Code that checks for async result: https://github.com/spring-projects/spring-amqp/blob/ed0a0b71d6aaf0ca29eb4e92afaa7561081a6e53/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/adapter/HandlerAdapter.java#L50-L56

Comment From: jensbaitingerbosch

That wis quick, thanks @artembilan