Using RabbitMQ v3.13.7 in a Docker container I am trying to understand how queues configured with a consumer-timeout behave if a message is NOT acknowledged within the timeout. From the
docs, "if a consumer does not ack its delivery within the timeout value its channel is closed ... with a channel exception".
Using either a classic or quorum durable queue, configured with x-consumer-timeout set during creation via the management console (and confirmed via the management console it is configured so), I ran a simple Spring Boot rabbit listener configured to MANUALLY acknowledge messages. What I found was that the message remained unacknowledged beyond the queue consumer-timeout value as shown in the management console, no exception was thrown and the message was not automatically dead-lettered/discarded/re-queued. I repeated the same test with a Python application also configured to manually acknowledge messages. The result was the same. I could only get the message to be re-queued if I stopped either application.
The Spring application:
@SpringBootApplication
public class RabbitMQMinimalApplication {
static void main(String[] args) {
SpringApplication.run(RabbitMQMinimalApplication.class, args);
}
@RabbitListener(queues = "incomingQueue")
public void listen(String in) {
log.info(in);
}
}
Its configuration:
spring.rabbitmq.listener.simple.acknowledge-mode=manual
spring.rabbitmq.listener.direct.acknowledge-mode=manual
The python application:
import pika
def callback(ch, method, properties, body):
print(f" [x] Received {body}")
if __name__ == '__main__':
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.basic_consume(queue='incomingQueue', on_message_callback=callback, auto_ack=False)
print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
It appears that consumer-timeouts are not working as per the documentation. Could anyone confirm this?
Thanks
Gary