Search code examples
rabbitmqspring-rabbit

Rabbitmq message expiration


Messages are not getting dropped after the expiration time. Using spring-rabbit java client I am sending the message with the header set with expiration:10000.

For reference here is the message present in Rabbitmq queue,

Properties
priority: 0

delivery_mode: 2

headers:
expiration: 10000

content_encoding: UTF-8

content_type: text/plain

Please help me if I need to set anything in Rabbitmq server or any extra parameter need to set?


Solution

  • expiration is a well-known message property, not a simple header.

    Properties are known to the broker, headers are generally arbitrary key/values used by the source and destination application, although some x-* headers have meaning to RabbitMQ.

    This message expires just fine:

    enter image description here

    With spring-amqp, it's a property on MessageProperties.