Class MessageProperties

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    StreamMessageProperties

    public class MessageProperties
    extends java.lang.Object
    implements java.io.Serializable
    Message Properties for an AMQP message.
    Author:
    Mark Fisher, Mark Pollack, Gary Russell, Dmitry Chernyshov, Artem Bilan, Csaba Soti
    See Also:
    Serialized Form
    • Field Detail

      • CONTENT_TYPE_BYTES

        public static final java.lang.String CONTENT_TYPE_BYTES
        See Also:
        Constant Field Values
      • CONTENT_TYPE_TEXT_PLAIN

        public static final java.lang.String CONTENT_TYPE_TEXT_PLAIN
        See Also:
        Constant Field Values
      • CONTENT_TYPE_SERIALIZED_OBJECT

        public static final java.lang.String CONTENT_TYPE_SERIALIZED_OBJECT
        See Also:
        Constant Field Values
      • CONTENT_TYPE_JSON

        public static final java.lang.String CONTENT_TYPE_JSON
        See Also:
        Constant Field Values
      • CONTENT_TYPE_JSON_ALT

        public static final java.lang.String CONTENT_TYPE_JSON_ALT
        See Also:
        Constant Field Values
      • CONTENT_TYPE_XML

        public static final java.lang.String CONTENT_TYPE_XML
        See Also:
        Constant Field Values
      • SPRING_BATCH_FORMAT

        public static final java.lang.String SPRING_BATCH_FORMAT
        See Also:
        Constant Field Values
      • BATCH_FORMAT_LENGTH_HEADER4

        public static final java.lang.String BATCH_FORMAT_LENGTH_HEADER4
        See Also:
        Constant Field Values
      • SPRING_AUTO_DECOMPRESS

        public static final java.lang.String SPRING_AUTO_DECOMPRESS
        See Also:
        Constant Field Values
      • DEFAULT_CONTENT_TYPE

        public static final java.lang.String DEFAULT_CONTENT_TYPE
        See Also:
        Constant Field Values
      • DEFAULT_PRIORITY

        public static final java.lang.Integer DEFAULT_PRIORITY
    • Constructor Detail

      • MessageProperties

        public MessageProperties()
    • Method Detail

      • setHeader

        public void setHeader​(java.lang.String key,
                              java.lang.Object value)
      • setHeaders

        public void setHeaders​(java.util.Map<java.lang.String,​java.lang.Object> headers)
        Set headers.
        Parameters:
        headers - the headers.
        Since:
        2.4.7
      • getHeader

        public <T> T getHeader​(java.lang.String headerName)
        Typed getter for a header.
        Type Parameters:
        T - the type.
        Parameters:
        headerName - the header name.
        Returns:
        the header value
        Since:
        2.2
      • getHeaders

        public java.util.Map<java.lang.String,​java.lang.Object> getHeaders()
      • setTimestamp

        public void setTimestamp​(java.util.Date timestamp)
      • getTimestamp

        public java.util.Date getTimestamp()
      • setMessageId

        public void setMessageId​(java.lang.String messageId)
      • getMessageId

        public java.lang.String getMessageId()
      • setUserId

        public void setUserId​(java.lang.String userId)
      • getUserId

        public java.lang.String getUserId()
      • getReceivedUserId

        public java.lang.String getReceivedUserId()
        Return the user id from an incoming message.
        Returns:
        the user id.
        Since:
        1.6
      • setReceivedUserId

        public void setReceivedUserId​(java.lang.String receivedUserId)
      • setAppId

        public void setAppId​(java.lang.String appId)
      • getAppId

        public java.lang.String getAppId()
      • setClusterId

        public void setClusterId​(java.lang.String clusterId)
      • getClusterId

        public java.lang.String getClusterId()
      • setType

        public void setType​(java.lang.String type)
      • getType

        public java.lang.String getType()
      • setCorrelationId

        public void setCorrelationId​(java.lang.String correlationId)
        Set the correlation id.
        Parameters:
        correlationId - the id.
      • getCorrelationId

        public java.lang.String getCorrelationId()
        Get the correlation id.
        Returns:
        the id.
      • setReplyTo

        public void setReplyTo​(java.lang.String replyTo)
      • getReplyTo

        public java.lang.String getReplyTo()
      • setReplyToAddress

        public void setReplyToAddress​(Address replyTo)
      • getReplyToAddress

        public Address getReplyToAddress()
      • setContentType

        public void setContentType​(java.lang.String contentType)
      • getContentType

        public java.lang.String getContentType()
      • setContentEncoding

        public void setContentEncoding​(java.lang.String contentEncoding)
      • getContentEncoding

        public java.lang.String getContentEncoding()
      • setContentLength

        public void setContentLength​(long contentLength)
      • getContentLength

        public long getContentLength()
      • isContentLengthSet

        protected final boolean isContentLengthSet()
      • setReceivedDeliveryMode

        public void setReceivedDeliveryMode​(MessageDeliveryMode receivedDeliveryMode)
      • setExpiration

        public void setExpiration​(java.lang.String expiration)
        Set the message expiration. This is a String property per the AMQP 0.9.1 spec. For RabbitMQ, this is a String representation of the message time to live in milliseconds.
        Parameters:
        expiration - the expiration.
      • getExpiration

        public java.lang.String getExpiration()
        Get the message expiration. This is a String property per the AMQP 0.9.1 spec. For RabbitMQ, this is a String representation of the message time to live in milliseconds.
        Returns:
        the expiration.
      • setPriority

        public void setPriority​(java.lang.Integer priority)
      • getPriority

        public java.lang.Integer getPriority()
      • setReceivedExchange

        public void setReceivedExchange​(java.lang.String receivedExchange)
      • getReceivedExchange

        public java.lang.String getReceivedExchange()
      • setReceivedRoutingKey

        public void setReceivedRoutingKey​(java.lang.String receivedRoutingKey)
      • getReceivedRoutingKey

        public java.lang.String getReceivedRoutingKey()
      • getReceivedDelay

        public java.lang.Integer getReceivedDelay()
        When a delayed message exchange is used the x-delay header on a received message contains the delay.
        Returns:
        the received delay.
        Since:
        1.6
        See Also:
        getDelay()
      • setReceivedDelay

        public void setReceivedDelay​(java.lang.Integer receivedDelay)
        When a delayed message exchange is used the x-delay header on a received message contains the delay.
        Parameters:
        receivedDelay - the received delay.
        Since:
        1.6
      • setRedelivered

        public void setRedelivered​(java.lang.Boolean redelivered)
      • isRedelivered

        public java.lang.Boolean isRedelivered()
      • getRedelivered

        public java.lang.Boolean getRedelivered()
      • setDeliveryTag

        public void setDeliveryTag​(long deliveryTag)
      • getDeliveryTag

        public long getDeliveryTag()
      • isDeliveryTagSet

        protected final boolean isDeliveryTagSet()
      • setMessageCount

        public void setMessageCount​(java.lang.Integer messageCount)
        Set the message count.
        Parameters:
        messageCount - the count
        See Also:
        getMessageCount()
      • getMessageCount

        public java.lang.Integer getMessageCount()
        Return the server's most recent estimate of the number of messages remaining on the queue. Only applies to messages retrieved via basicGet.
        Returns:
        the count.
      • getConsumerTag

        public java.lang.String getConsumerTag()
      • setConsumerTag

        public void setConsumerTag​(java.lang.String consumerTag)
      • getConsumerQueue

        public java.lang.String getConsumerQueue()
      • setConsumerQueue

        public void setConsumerQueue​(java.lang.String consumerQueue)
      • getDelay

        public java.lang.Integer getDelay()
        The x-delay header (outbound).
        Returns:
        the delay.
        Since:
        1.6
        See Also:
        getReceivedDelay()
      • setDelay

        public void setDelay​(java.lang.Integer delay)
        Set the x-delay header.
        Parameters:
        delay - the delay.
        Since:
        1.6
      • isFinalRetryForMessageWithNoId

        public boolean isFinalRetryForMessageWithNoId()
      • setFinalRetryForMessageWithNoId

        public void setFinalRetryForMessageWithNoId​(boolean finalRetryForMessageWithNoId)
      • getPublishSequenceNumber

        public long getPublishSequenceNumber()
        Return the publish sequence number if publisher confirms are enabled; set by the template.
        Returns:
        the sequence number.
        Since:
        2.1
      • setPublishSequenceNumber

        public void setPublishSequenceNumber​(long publishSequenceNumber)
        Set the publish sequence number, if publisher confirms are enabled; set by the template.
        Parameters:
        publishSequenceNumber - the sequence number.
        Since:
        2.1
      • getInferredArgumentType

        public java.lang.reflect.Type getInferredArgumentType()
        The inferred target argument type when using a method-level @RabbitListener.
        Returns:
        the type.
        Since:
        1.6
      • setInferredArgumentType

        public void setInferredArgumentType​(java.lang.reflect.Type inferredArgumentType)
        Set the inferred target argument type when using a method-level @RabbitListener.
        Parameters:
        inferredArgumentType - the type.
        Since:
        1.6
      • getTargetMethod

        public java.lang.reflect.Method getTargetMethod()
        The target method when using a @RabbitListener.
        Returns:
        the method.
        Since:
        1.6
      • setTargetMethod

        public void setTargetMethod​(java.lang.reflect.Method targetMethod)
        Set the target method when using a @RabbitListener.
        Parameters:
        targetMethod - the target method.
        Since:
        1.6
      • getTargetBean

        public java.lang.Object getTargetBean()
        The target bean when using @RabbitListener.
        Returns:
        the bean.
        Since:
        1.6
      • setTargetBean

        public void setTargetBean​(java.lang.Object targetBean)
        Set the target bean when using @RabbitListener.
        Parameters:
        targetBean - the bean.
        Since:
        1.6
      • isLastInBatch

        public boolean isLastInBatch()
        When true; the message having these properties is the last message from a batch.
        Returns:
        true for the last message.
        Since:
        2.2
      • setLastInBatch

        public void setLastInBatch​(boolean lastInBatch)
        Set to true to indicate these properties are for the last message in a batch.
        Parameters:
        lastInBatch - true for the last.
        Since:
        2.2
      • isProjectionUsed

        public boolean isProjectionUsed()
        Get an internal flag used to communicate that conversion used projection; always false at the application level.
        Returns:
        true if projection was used.
        Since:
        2.2.20
      • setProjectionUsed

        public void setProjectionUsed​(boolean projectionUsed)
        Set an internal flag used to communicate that conversion used projection; always false at the application level.
        Parameters:
        projectionUsed - true for projection.
        Since:
        2.2.20
      • getXDeathHeader

        public java.util.List<java.util.Map<java.lang.String,​?>> getXDeathHeader()
        Return the x-death header.
        Returns:
        the header.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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