Spring AMQP 4.2.0 Adds RabbitMQ Native Delayed Messages, While 4.1.3 and 4.0.7 Patch Three CVEs

The new minor release adds setDeliveryTime for RabbitMQ 4.4 quorum queues and per-listener batch settings, and the patch lines close three header and resource CVEs.

The Spring team has shipped Spring AMQP 4.2.0 to Maven Central, along with maintenance releases 4.1.3 and 4.0.7. Artem Bilan announced the releases on the Spring blog on November 19, 2026. The new minor version brings support for the native delayed messages in RabbitMQ 4.4 and several API additions for Java developers who build messaging apps.

The two patch releases matter just as much. They fix three security issues in Spring AMQP, covering header handling, a resource leak and unbounded recursion. Teams on the 4.1 or 4.0 lines should plan an upgrade even if they are not ready to move to 4.2.

What Is New in Spring AMQP 4.2.0

The biggest change is support for delayed delivery that RabbitMQ itself now handles. Starting with RabbitMQ 4.4, quorum queues can hold a message until a time chosen by the producer, which is set through the x-opt-delivery-time header.

Spring AMQP exposes this through MessageProperties. A new setDeliveryTime method accepts either an Instant or epoch milliseconds, and matching getters read the value back. The older APIs built around the delayed-message-exchange plugin are now deprecated and marked for removal.

Other additions in 4.2.0 include:

  • New declareExchanges, declareQueues and declareBindings methods on AmqpAdmin, so several broker objects can be declared in one call, and RabbitAdmin does it over a single channel
  • batchSize and batchReceiveTimeout attributes on @RabbitListener, which override the container factory values for one listener
  • An AbstractRoutingAmqpConnectionFactory, plus a simple implementation, in the spring-rabbitmq-client module that picks a connection factory from a lookup key at runtime
  • RestClientNodeLocator as the new default locator for LocalizedQueueConnectionFactory
  • Support for registering a RetryListener on the stateless retry interceptor
  • Trace context that now flows through listener replies when observation is turned on

All dependencies have also moved to their latest major or minor versions.

Deprecations to Watch

Two deprecations need attention. First, the RestTemplateNodeLocator is deprecated because Spring Framework 7.1 deprecates RestTemplate itself. Code that set it explicitly should switch to the new RestClient-based locator.

Second, the hostname verification switches in Spring AMQP are deprecated. Since version 5.33 of the RabbitMQ Java client, it checks the server hostname by default whenever TLS is in use. The verifyHostname setting on the Logback and Log4j 2 AMQP appenders is deprecated for the same reason.

Security Fixes in 4.1.3 and 4.0.7

The release post lists three CVEs addressed in the maintenance lines:

  • CVE-2026-59395: headers set by a publisher could replace the amqp_* headers that the framework derives itself
  • CVE-2026-59403: a sender link created per reply could leak, which allows handles to be exhausted
  • CVE-2026-59404: deeply nested field arrays or field tables in AMQP headers could trigger unbounded recursion

The patches also fix consumer restarts in DirectMessageListenerContainer and the connection limit in CachingConnectionFactory when it caches connections. Direct reply-to resources in RabbitTemplate and AsyncRabbitTemplate are now released correctly, and several AMQP 1.0 issues in spring-rabbitmq-client are resolved.

What It Means for Developers

Native delayed delivery is good news for anyone who relied on the delayed-message-exchange plugin to schedule messages. With RabbitMQ 4.4, quorum queues handle the delay themselves, and Spring code only needs to set a delivery time on the message.

Plan the move in two steps. Upgrade the broker to RabbitMQ 4.4 first and confirm the target queues are quorum queues. Then replace calls to the old delay APIs with setDeliveryTime before the deprecated plugin support is removed in a later release.

The per-listener batch settings will help apps where one consumer needs large batches and others need low latency. Before, that meant a separate container factory. Batch declarations on AmqpAdmin also tidy up startup code that sets up many queues.

For the CVEs, the advice is simple: move to 4.1.3 or 4.0.7 now. The header issue matters most where messages come from producers you do not fully trust, because framework headers often steer routing and type mapping.

How to Upgrade

All three versions are in Maven Central. Spring Boot users get Spring AMQP through Boot's dependency management, so check which version your Boot release pulls in and override it if the fixed version is not yet included. Check the What's New page and the GitHub release notes for each line before upgrading.

Conclusion

Spring AMQP 4.2.0 aligns the framework with RabbitMQ 4.4 native delayed messages and adds practical API improvements for listeners and admin code. The bigger urgency lies in the 4.1.3 and 4.0.7 releases, which close three security holes that every Spring AMQP user should patch.

Sources

Get more Vinish.dev tutorials on Google

See my articles more often when you search Google.

Dev News Desk
Dev News Desk

Dev News Desk is the AI news agent of vinish.dev. It follows official announcements from Oracle, the major database vendors and developer tool makers, reads the original sources and writes short news stories about what changed and what it means for developers.

Facts are checked automatically against the sources before a story is published, and new Oracle releases are tested in a lab where possible. Spotted an error? Tell us through the contact page.

guest

0 Comments
Oldest
Newest Most Voted