Class CorrelationData

  • All Implemented Interfaces:
    org.springframework.amqp.core.Correlation

    public class CorrelationData
    extends java.lang.Object
    implements org.springframework.amqp.core.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
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CorrelationData.Confirm
      Represents a publisher confirmation.
    • Constructor Summary

      Constructors 
      Constructor Description
      CorrelationData()
      Construct an instance with a null Id.
      CorrelationData​(java.lang.String id)
      Construct an instance with the supplied id.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      org.springframework.util.concurrent.SettableListenableFuture<CorrelationData.Confirm> getFuture()
      Return a future to check the success/failure of the publish operation.
      java.lang.String getId()
      Return the id.
      org.springframework.amqp.core.ReturnedMessage getReturned()
      Get the returned message and metadata, if any.
      org.springframework.amqp.core.Message getReturnedMessage()
      Deprecated.
      in favor of getReturned().
      void setId​(java.lang.String id)
      Set the correlation id.
      void setReturned​(org.springframework.amqp.core.ReturnedMessage returned)
      Set the returned message and metadata.
      void setReturnedMessage​(org.springframework.amqp.core.Message returnedMessage)
      Deprecated.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CorrelationData

        public CorrelationData()
        Construct an instance with a null Id.
        Since:
        1.6.7
      • CorrelationData

        public CorrelationData​(java.lang.String id)
        Construct an instance with the supplied id. Must be unique if returns are enabled to allow population of the returned message.
        Parameters:
        id - the id.
    • Method Detail

      • getId

        public java.lang.String getId()
        Return the id.
        Returns:
        the id.
      • setId

        public void setId​(java.lang.String id)
        Set the correlation id. Generally, the correlation id shouldn't be changed. One use case, however, is when it needs to be set in a MessagePostProcessor.
        Parameters:
        id - the id.
        Since:
        1.6
      • getFuture

        public org.springframework.util.concurrent.SettableListenableFuture<CorrelationData.Confirm> getFuture()
        Return a future to check the success/failure of the publish operation.
        Returns:
        the future.
        Since:
        2.1
      • getReturnedMessage

        @Deprecated
        @Nullable
        public org.springframework.amqp.core.Message getReturnedMessage()
        Deprecated.
        in favor of getReturned().
        Return a returned message, if any; requires a unique id. Guaranteed to be populated before the future is set.
        Returns:
        the message or null.
        Since:
        2.1
      • setReturnedMessage

        @Deprecated
        public void setReturnedMessage​(org.springframework.amqp.core.Message returnedMessage)
        Deprecated.
        Set a returned message for this correlation data.
        Parameters:
        returnedMessage - the returned message.
        Since:
        1.7.13
      • getReturned

        @Nullable
        public org.springframework.amqp.core.ReturnedMessage getReturned()
        Get the returned message and metadata, if any. Guaranteed to be populated before the future is set.
        Returns:
        the ReturnedMessage.
        Since:
        2.3.3
      • setReturned

        public void setReturned​(org.springframework.amqp.core.ReturnedMessage returned)
        Set the returned message and metadata.
        Parameters:
        returned - the ReturnedMessage.
        Since:
        2.3.3
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object