Class CorrelationData
java.lang.Object
org.springframework.amqp.rabbit.connection.CorrelationData
- All Implemented Interfaces:
Correlation
Base class for correlating publisher confirms to sent messages. Use the
RabbitTemplate
methods that include one of
these as a parameter; when the publisher confirm is received, the CorrelationData is
returned with the ack/nack. When returns are also enabled, the
returned
property will be populated when a
message can't be delivered - the return always arrives before the confirmation. In this
case the #id
property must be set to a unique value. If no id is provided it
will automatically set to a unique value.- Since:
- 1.0.1
- Author:
- Gary Russell
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a publisher confirmation. -
Constructor Summary
ConstructorDescriptionConstruct an instance with a null Id.Construct an instance with the supplied id. -
Method Summary
Modifier and TypeMethodDescriptionReturn a future to check the success/failure of the publish operation.getId()
Return the id.Get the returned message and metadata, if any.void
Set the correlation id.void
setReturned
(ReturnedMessage returned) Set the returned message and metadata.toString()
-
Constructor Details
-
CorrelationData
public CorrelationData()Construct an instance with a null Id.- Since:
- 1.6.7
-
CorrelationData
Construct an instance with the supplied id. Must be unique if returns are enabled to allow population of thereturned
message.- Parameters:
id
- the id.
-
-
Method Details
-
getId
Return the id.- Returns:
- the id.
-
setId
Set the correlation id. Generally, the correlation id shouldn't be changed. One use case, however, is when it needs to be set in aMessagePostProcessor
.- Parameters:
id
- the id.- Since:
- 1.6
-
getFuture
Return a future to check the success/failure of the publish operation.- Returns:
- the future.
- Since:
- 2.1
-
getReturned
Get the returned message and metadata, if any. Guaranteed to be populated before the future is completed.- Returns:
- the
ReturnedMessage
. - Since:
- 2.3.3
-
setReturned
Set the returned message and metadata.- Parameters:
returned
- theReturnedMessage
.- Since:
- 2.3.3
-
toString
-