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.SerializableMessage 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.StringBATCH_FORMAT_LENGTH_HEADER4static java.lang.StringCONTENT_TYPE_BYTESstatic java.lang.StringCONTENT_TYPE_JSONstatic java.lang.StringCONTENT_TYPE_JSON_ALTstatic java.lang.StringCONTENT_TYPE_SERIALIZED_OBJECTstatic java.lang.StringCONTENT_TYPE_TEXT_PLAINstatic java.lang.StringCONTENT_TYPE_XMLstatic java.lang.StringDEFAULT_CONTENT_TYPEstatic MessageDeliveryModeDEFAULT_DELIVERY_MODEstatic java.lang.IntegerDEFAULT_PRIORITYstatic java.lang.StringSPRING_AUTO_DECOMPRESSstatic java.lang.StringSPRING_BATCH_FORMATstatic java.lang.StringX_DELAY
-
Constructor Summary
Constructors Constructor Description MessageProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetAppId()java.lang.StringgetClusterId()java.lang.StringgetConsumerQueue()java.lang.StringgetConsumerTag()java.lang.StringgetContentEncoding()longgetContentLength()java.lang.StringgetContentType()java.lang.StringgetCorrelationId()Get the correlation id.java.lang.IntegergetDelay()The x-delay header (outbound).MessageDeliveryModegetDeliveryMode()longgetDeliveryTag()java.lang.StringgetExpiration()Get the message expiration.<T> TgetHeader(java.lang.String headerName)Typed getter for a header.java.util.Map<java.lang.String,java.lang.Object>getHeaders()java.lang.reflect.TypegetInferredArgumentType()The inferred target argument type when using a method-level@RabbitListener.java.lang.IntegergetMessageCount()Return the server's most recent estimate of the number of messages remaining on the queue.java.lang.StringgetMessageId()java.lang.IntegergetPriority()longgetPublishSequenceNumber()Return the publish sequence number if publisher confirms are enabled; set by the template.java.lang.IntegergetReceivedDelay()When a delayed message exchange is used the x-delay header on a received message contains the delay.MessageDeliveryModegetReceivedDeliveryMode()java.lang.StringgetReceivedExchange()java.lang.StringgetReceivedRoutingKey()java.lang.StringgetReceivedUserId()Return the user id from an incoming message.java.lang.BooleangetRedelivered()java.lang.StringgetReplyTo()AddressgetReplyToAddress()java.lang.ObjectgetTargetBean()The target bean when using@RabbitListener.java.lang.reflect.MethodgetTargetMethod()The target method when using a@RabbitListener.java.util.DategetTimestamp()java.lang.StringgetType()java.lang.StringgetUserId()java.util.List<java.util.Map<java.lang.String,?>>getXDeathHeader()Return the x-death header.inthashCode()protected booleanisContentLengthSet()protected booleanisDeliveryTagSet()booleanisFinalRetryForMessageWithNoId()booleanisLastInBatch()When true; the message having these properties is the last message from a batch.booleanisProjectionUsed()Get an internal flag used to communicate that conversion used projection; always false at the application level.java.lang.BooleanisRedelivered()voidsetAppId(java.lang.String appId)voidsetClusterId(java.lang.String clusterId)voidsetConsumerQueue(java.lang.String consumerQueue)voidsetConsumerTag(java.lang.String consumerTag)voidsetContentEncoding(java.lang.String contentEncoding)voidsetContentLength(long contentLength)voidsetContentType(java.lang.String contentType)voidsetCorrelationId(java.lang.String correlationId)Set the correlation id.voidsetDelay(java.lang.Integer delay)Set the x-delay header.voidsetDeliveryMode(MessageDeliveryMode deliveryMode)voidsetDeliveryTag(long deliveryTag)voidsetExpiration(java.lang.String expiration)Set the message expiration.voidsetFinalRetryForMessageWithNoId(boolean finalRetryForMessageWithNoId)voidsetHeader(java.lang.String key, java.lang.Object value)voidsetHeaders(java.util.Map<java.lang.String,java.lang.Object> headers)Set headers.voidsetInferredArgumentType(java.lang.reflect.Type inferredArgumentType)Set the inferred target argument type when using a method-level@RabbitListener.voidsetLastInBatch(boolean lastInBatch)Set to true to indicate these properties are for the last message in a batch.voidsetMessageCount(java.lang.Integer messageCount)Set the message count.voidsetMessageId(java.lang.String messageId)voidsetPriority(java.lang.Integer priority)voidsetProjectionUsed(boolean projectionUsed)Set an internal flag used to communicate that conversion used projection; always false at the application level.voidsetPublishSequenceNumber(long publishSequenceNumber)Set the publish sequence number, if publisher confirms are enabled; set by the template.voidsetReceivedDelay(java.lang.Integer receivedDelay)When a delayed message exchange is used the x-delay header on a received message contains the delay.voidsetReceivedDeliveryMode(MessageDeliveryMode receivedDeliveryMode)voidsetReceivedExchange(java.lang.String receivedExchange)voidsetReceivedRoutingKey(java.lang.String receivedRoutingKey)voidsetReceivedUserId(java.lang.String receivedUserId)voidsetRedelivered(java.lang.Boolean redelivered)voidsetReplyTo(java.lang.String replyTo)voidsetReplyToAddress(Address replyTo)voidsetTargetBean(java.lang.Object targetBean)Set the target bean when using@RabbitListener.voidsetTargetMethod(java.lang.reflect.Method targetMethod)Set the target method when using a@RabbitListener.voidsetTimestamp(java.util.Date timestamp)voidsetType(java.lang.String type)voidsetUserId(java.lang.String userId)java.lang.StringtoString()
-
-
-
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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-