Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreWe are pleased to announce the availability of the Release Candidate for Spring AMQP 1.4; the GA is planned to be released in early November.
First of all, thank you all who provided feedback for the milestone 1.4 M1 version and submitted reports (bugs or new features).
Special thanks to Stéphane Nicoll, who had introduced annotation-based message
listeners (@RabbitListener
) and the new RabbitMessagingTemplate
.
@SendTo
annotation to send the result of the method as a reply message (when there's no replyTo
in the inbound message):@RabbitListener(queues = "capitalize")
@SendTo("capitalize.reply")
public String capitalize(String s) {
return s.toUpperCase();
}
(Annotation-basd listeners require Spring Framework 4.1.x).
A new RabbitMessagingTemplate
has been introduced, allowing the use of the spring-messaging
Message<?>
abstraction as an alternative to the Spring AMQP Message
(Spring Messaging Message<?>
is also supported by the annotated listeners).
The Logback AmqpAppender
is now available, with configuration similar to the existing Log4j AmqpAppender
:
<appender name="AMQP" class="org.springframework.amqp.rabbit.logback.AmqpAppender">
<layout>
<pattern><![CDATA[ %d %p %t [%c] - <%m>%n ]]></pattern>
</layout>
<abbreviation>36</abbreviation>
<applicationId>MyApplication</applicationId>
<routingKeyPattern>%property{applicationId}.%c.%p</routingKeyPattern>
<generateId>true</generateId>
<charset>UTF-8</charset>
<durable>false</durable>
<deliveryMode>NON_PERSISTENT</deliveryMode>
</appender>
RabbitTemplate
can now be configured with an AbstractRoutingConnectionFactory
with expression
attributes to determine the target ConnectionFactory
depending on the RabbitTemplate
operation:<rabbit:template connection-factory="RoutingConnectionFactory"
send-connection-factory-selector-expression="messageProperties.userId"
receive-connection-factory-selector-expression="#root == 'fooQueue' ? 'foo' : null"/>
mandatory-expression
attribute has been added to the RabbitTemplate
to set the mandatory
flag for each sent message:<rabbit:template connection-factory="connectionFactory"
mandatory-expression="messageProperties.contentType == 'application/json'"/>
(Previously, mandatory
was set at the template level).
AbstractRoutingConnectionFactory
is now also supported for the MessageListenerContainer
, where the key
forthe target ConnectionFactory
is based on the configured queueNames
array
See the Release Notes and the Project Page for more information.