This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Integration 7.1.1!

Delayed Message Delivery

Starting with RabbitMQ 4.4, quorum queues support native delayed delivery via the x-opt-delivery-time message header (MessageProperties.DELIVERY_TIME). Its value is an absolute Unix timestamp in milliseconds, not a relative delay. See the Spring AMQP documentation for more information.

Starting with version 7.2, the AMQP outbound endpoints provide a deliveryTimeExpression property (delivery-time-expression when using XML configuration). The expression must evaluate to a java.time.Instant, a java.util.Date, or a Number of epoch milliseconds, which is set as the x-opt-delivery-time header on the outbound AMQP message. With the Java DSL, a Function<Message<?>, ?> variant is also available:

Amqp.outboundAdapter(amqpTemplate)
        .routingKey("quorumQueue")
        .deliveryTimeExpression(m -> Instant.now().plusSeconds(10))

The DefaultAmqpHeaderMapper also maps an x-opt-delivery-time (MessageProperties.DELIVERY_TIME) message header to the AMQP message by default, even though other x-* headers are not mapped. The header value can be a Number of epoch milliseconds, an Instant, or a Date. The deliveryTimeExpression takes precedence over this header.

Delayed Message Exchange Plugin

The RabbitMQ Delayed Message Exchange Plugin is not maintained anymore, and its support is deprecated for removal since version 7.2, aligned with Spring AMQP 4.2.

Spring AMQP supports the RabbitMQ Delayed Message Exchange Plugin. Starting with version 7.2, the received x-delay value is no longer mapped to the AmqpHeaders.RECEIVED_DELAY header by default. The AmqpHeaders.DELAY header is also not mapped to the x-delay header of outbound messages by default anymore. Use the delay and delayExpression properties on outbound endpoints (delay-expression when using XML configuration) instead.