Package org.springframework.amqp.core
Class MessageProperties
- java.lang.Object
-
- org.springframework.amqp.core.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 Summary
Fields Modifier and Type Field Description static java.lang.String
BATCH_FORMAT_LENGTH_HEADER4
static java.lang.String
CONTENT_TYPE_BYTES
static java.lang.String
CONTENT_TYPE_JSON
static java.lang.String
CONTENT_TYPE_JSON_ALT
static java.lang.String
CONTENT_TYPE_SERIALIZED_OBJECT
static java.lang.String
CONTENT_TYPE_TEXT_PLAIN
static java.lang.String
CONTENT_TYPE_XML
static java.lang.String
DEFAULT_CONTENT_TYPE
static MessageDeliveryMode
DEFAULT_DELIVERY_MODE
static java.lang.Integer
DEFAULT_PRIORITY
static java.lang.String
SPRING_AUTO_DECOMPRESS
static java.lang.String
SPRING_BATCH_FORMAT
static java.lang.String
X_DELAY
-
Constructor Summary
Constructors Constructor Description MessageProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getAppId()
java.lang.String
getClusterId()
java.lang.String
getConsumerQueue()
java.lang.String
getConsumerTag()
java.lang.String
getContentEncoding()
long
getContentLength()
java.lang.String
getContentType()
java.lang.String
getCorrelationId()
Get the correlation id.java.lang.Integer
getDelay()
The x-delay header (outbound).MessageDeliveryMode
getDeliveryMode()
long
getDeliveryTag()
java.lang.String
getExpiration()
Get the message expiration.<T> T
getHeader(java.lang.String headerName)
Typed getter for a header.java.util.Map<java.lang.String,java.lang.Object>
getHeaders()
java.lang.reflect.Type
getInferredArgumentType()
The inferred target argument type when using a method-level@RabbitListener
.java.lang.Integer
getMessageCount()
Return the server's most recent estimate of the number of messages remaining on the queue.java.lang.String
getMessageId()
java.lang.Integer
getPriority()
long
getPublishSequenceNumber()
Return the publish sequence number if publisher confirms are enabled; set by the template.java.lang.Integer
getReceivedDelay()
When a delayed message exchange is used the x-delay header on a received message contains the delay.MessageDeliveryMode
getReceivedDeliveryMode()
java.lang.String
getReceivedExchange()
java.lang.String
getReceivedRoutingKey()
java.lang.String
getReceivedUserId()
Return the user id from an incoming message.java.lang.Boolean
getRedelivered()
java.lang.String
getReplyTo()
Address
getReplyToAddress()
java.lang.Object
getTargetBean()
The target bean when using@RabbitListener
.java.lang.reflect.Method
getTargetMethod()
The target method when using a@RabbitListener
.java.util.Date
getTimestamp()
java.lang.String
getType()
java.lang.String
getUserId()
java.util.List<java.util.Map<java.lang.String,?>>
getXDeathHeader()
Return the x-death header.int
hashCode()
protected boolean
isContentLengthSet()
protected boolean
isDeliveryTagSet()
boolean
isFinalRetryForMessageWithNoId()
boolean
isLastInBatch()
When true; the message having these properties is the last message from a batch.boolean
isProjectionUsed()
Get an internal flag used to communicate that conversion used projection; always false at the application level.java.lang.Boolean
isRedelivered()
void
setAppId(java.lang.String appId)
void
setClusterId(java.lang.String clusterId)
void
setConsumerQueue(java.lang.String consumerQueue)
void
setConsumerTag(java.lang.String consumerTag)
void
setContentEncoding(java.lang.String contentEncoding)
void
setContentLength(long contentLength)
void
setContentType(java.lang.String contentType)
void
setCorrelationId(java.lang.String correlationId)
Set the correlation id.void
setDelay(java.lang.Integer delay)
Set the x-delay header.void
setDeliveryMode(MessageDeliveryMode deliveryMode)
void
setDeliveryTag(long deliveryTag)
void
setExpiration(java.lang.String expiration)
Set the message expiration.void
setFinalRetryForMessageWithNoId(boolean finalRetryForMessageWithNoId)
void
setHeader(java.lang.String key, java.lang.Object value)
void
setHeaders(java.util.Map<java.lang.String,java.lang.Object> headers)
Set headers.void
setInferredArgumentType(java.lang.reflect.Type inferredArgumentType)
Set the inferred target argument type when using a method-level@RabbitListener
.void
setLastInBatch(boolean lastInBatch)
Set to true to indicate these properties are for the last message in a batch.void
setMessageCount(java.lang.Integer messageCount)
Set the message count.void
setMessageId(java.lang.String messageId)
void
setPriority(java.lang.Integer priority)
void
setProjectionUsed(boolean projectionUsed)
Set an internal flag used to communicate that conversion used projection; always false at the application level.void
setPublishSequenceNumber(long publishSequenceNumber)
Set the publish sequence number, if publisher confirms are enabled; set by the template.void
setReceivedDelay(java.lang.Integer receivedDelay)
When a delayed message exchange is used the x-delay header on a received message contains the delay.void
setReceivedDeliveryMode(MessageDeliveryMode receivedDeliveryMode)
void
setReceivedExchange(java.lang.String receivedExchange)
void
setReceivedRoutingKey(java.lang.String receivedRoutingKey)
void
setReceivedUserId(java.lang.String receivedUserId)
void
setRedelivered(java.lang.Boolean redelivered)
void
setReplyTo(java.lang.String replyTo)
void
setReplyToAddress(Address replyTo)
void
setTargetBean(java.lang.Object targetBean)
Set the target bean when using@RabbitListener
.void
setTargetMethod(java.lang.reflect.Method targetMethod)
Set the target method when using a@RabbitListener
.void
setTimestamp(java.util.Date timestamp)
void
setType(java.lang.String type)
void
setUserId(java.lang.String userId)
java.lang.String
toString()
-
-
-
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
-
X_DELAY
public static final java.lang.String X_DELAY
- See Also:
- Constant Field Values
-
DEFAULT_CONTENT_TYPE
public static final java.lang.String DEFAULT_CONTENT_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_DELIVERY_MODE
public static final MessageDeliveryMode DEFAULT_DELIVERY_MODE
-
DEFAULT_PRIORITY
public static final java.lang.Integer DEFAULT_PRIORITY
-
-
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()
-
setDeliveryMode
public void setDeliveryMode(MessageDeliveryMode deliveryMode)
-
getDeliveryMode
public MessageDeliveryMode getDeliveryMode()
-
getReceivedDeliveryMode
public MessageDeliveryMode getReceivedDeliveryMode()
-
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 viabasicGet
.- 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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-