Skip to content
Permalink
Browse files

AMQP-840: RabbitTemplate add hook for timeouts

  • Loading branch information...
garyrussell authored and artembilan committed Nov 8, 2018
1 parent ccf1dc7 commit ddf4f3ed526933e4e901e09ffc8b19129f0cfb85
@@ -1863,9 +1863,21 @@ private Message exchangeMessages(final String exchange, final String routingKey,
if (this.logger.isDebugEnabled()) {
this.logger.debug("Reply: " + reply);
}
if (reply == null) {
replyTimedOut(message.getMessageProperties().getCorrelationId());
}
return reply;
}

/**
* Subclasses can implement this to be notified that a reply has timed out.
* @param correlationId the correlationId
* @since 2.1.2
*/
protected void replyTimedOut(String correlationId) {
// NOSONAR
}

/**
* Return whether the provided message should be sent with the mandatory flag set.
* @param message the message.
@@ -3204,7 +3204,7 @@ This is `false` now by default.

By default, the send and receive methods will timeout after 5 seconds and return null.
This can be modified by setting the `replyTimeout` property.
Starting with _version 1.5_, if you set the `mandatory` property to true (or the `mandatory-expression` evaluates to
Starting with version 1.5, if you set the `mandatory` property to true (or the `mandatory-expression` evaluates to
`true` for a particular message), if the message cannot be delivered to a queue an `AmqpMessageReturnedException` will
be thrown.
This exception has `returnedMessage`, `replyCode`, `replyText` properties, as well as the `exchange` and
@@ -3214,6 +3214,8 @@ NOTE: This feature uses publisher returns and is enabled by setting `publisherRe
`CachingConnectionFactory` (see <<cf-pub-conf-ret>>).
Also, you must not have registered your own `ReturnCallback` with the `RabbitTemplate`.

Starting with version 2.1.2, a method `replyTimedOut` has been added, allowing subclasses to be informed of the timeout so they can clean up any retained state.

[[direct-reply-to]]
===== RabbitMQ Direct reply-to

@@ -55,6 +55,9 @@ See <<request-reply>> for more information.
When returns and confirms are enabled, the correlation data, if provided, is populated with the returned message.
See <<template-confirms>> for more information.

A method `replyTimedOut` is now provided to notify subclasses that a reply has timed out, allowing for any state cleanup.
See <<reply-timeout>> for more information.

===== Message Conversion

A new `Jackson2XmlMessageConverter` is introduced to support converting messages from/to XML format.

0 comments on commit ddf4f3e

Please sign in to comment.
You can’t perform that action at this time.