Package org.springframework.amqp.core
Class MessageProperties
- java.lang.Object
-
- org.springframework.amqp.core.MessageProperties
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StreamMessageProperties
public class MessageProperties extends Object implements 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 String
BATCH_FORMAT_LENGTH_HEADER4
static String
CONTENT_TYPE_BYTES
static String
CONTENT_TYPE_JSON
static String
CONTENT_TYPE_JSON_ALT
static String
CONTENT_TYPE_SERIALIZED_OBJECT
static String
CONTENT_TYPE_TEXT_PLAIN
static String
CONTENT_TYPE_XML
static String
DEFAULT_CONTENT_TYPE
static MessageDeliveryMode
DEFAULT_DELIVERY_MODE
static Integer
DEFAULT_PRIORITY
static String
SPRING_AUTO_DECOMPRESS
static String
SPRING_BATCH_FORMAT
static String
X_DELAY
-
Constructor Summary
Constructors Constructor Description MessageProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getAppId()
String
getClusterId()
String
getConsumerQueue()
String
getConsumerTag()
String
getContentEncoding()
long
getContentLength()
String
getContentType()
String
getCorrelationId()
Get the correlation id.Integer
getDelay()
The x-delay header (outbound).MessageDeliveryMode
getDeliveryMode()
long
getDeliveryTag()
String
getExpiration()
<T> T
getHeader(String headerName)
Typed getter for a header.Map<String,Object>
getHeaders()
Type
getInferredArgumentType()
The inferred target argument type when using a method-level@RabbitListener
.Integer
getMessageCount()
Return the server's most recent estimate of the number of messages remaining on the queue.String
getMessageId()
Integer
getPriority()
long
getPublishSequenceNumber()
Return the publish sequence number if publisher confirms are enabled; set by the template.Integer
getReceivedDelay()
When a delayed message exchange is used the x-delay header on a received message contains the delay.MessageDeliveryMode
getReceivedDeliveryMode()
String
getReceivedExchange()
String
getReceivedRoutingKey()
String
getReceivedUserId()
Return the user id from an incoming message.Boolean
getRedelivered()
String
getReplyTo()
Address
getReplyToAddress()
Object
getTargetBean()
The target bean when using@RabbitListener
.Method
getTargetMethod()
The target method when using a@RabbitListener
.Date
getTimestamp()
String
getType()
String
getUserId()
List<Map<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.Boolean
isRedelivered()
void
setAppId(String appId)
void
setClusterId(String clusterId)
void
setConsumerQueue(String consumerQueue)
void
setConsumerTag(String consumerTag)
void
setContentEncoding(String contentEncoding)
void
setContentLength(long contentLength)
void
setContentType(String contentType)
void
setCorrelationId(String correlationId)
Set the correlation id.void
setDelay(Integer delay)
Set the x-delay header.void
setDeliveryMode(MessageDeliveryMode deliveryMode)
void
setDeliveryTag(long deliveryTag)
void
setExpiration(String expiration)
void
setFinalRetryForMessageWithNoId(boolean finalRetryForMessageWithNoId)
void
setHeader(String key, Object value)
void
setHeaders(Map<String,Object> headers)
Set headers.void
setInferredArgumentType(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(Integer messageCount)
Set the message count.void
setMessageId(String messageId)
void
setPriority(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(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(String receivedExchange)
void
setReceivedRoutingKey(String receivedRoutingKey)
void
setReceivedUserId(String receivedUserId)
void
setRedelivered(Boolean redelivered)
void
setReplyTo(String replyTo)
void
setReplyToAddress(Address replyTo)
void
setTargetBean(Object targetBean)
Set the target bean when using@RabbitListener
.void
setTargetMethod(Method targetMethod)
Set the target method when using a@RabbitListener
.void
setTimestamp(Date timestamp)
void
setType(String type)
void
setUserId(String userId)
String
toString()
-
-
-
Field Detail
-
CONTENT_TYPE_BYTES
public static final String CONTENT_TYPE_BYTES
- See Also:
- Constant Field Values
-
CONTENT_TYPE_TEXT_PLAIN
public static final String CONTENT_TYPE_TEXT_PLAIN
- See Also:
- Constant Field Values
-
CONTENT_TYPE_SERIALIZED_OBJECT
public static final String CONTENT_TYPE_SERIALIZED_OBJECT
- See Also:
- Constant Field Values
-
CONTENT_TYPE_JSON
public static final String CONTENT_TYPE_JSON
- See Also:
- Constant Field Values
-
CONTENT_TYPE_JSON_ALT
public static final String CONTENT_TYPE_JSON_ALT
- See Also:
- Constant Field Values
-
CONTENT_TYPE_XML
public static final String CONTENT_TYPE_XML
- See Also:
- Constant Field Values
-
SPRING_BATCH_FORMAT
public static final String SPRING_BATCH_FORMAT
- See Also:
- Constant Field Values
-
BATCH_FORMAT_LENGTH_HEADER4
public static final String BATCH_FORMAT_LENGTH_HEADER4
- See Also:
- Constant Field Values
-
SPRING_AUTO_DECOMPRESS
public static final String SPRING_AUTO_DECOMPRESS
- See Also:
- Constant Field Values
-
X_DELAY
public static final String X_DELAY
- See Also:
- Constant Field Values
-
DEFAULT_CONTENT_TYPE
public static final String DEFAULT_CONTENT_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_DELIVERY_MODE
public static final MessageDeliveryMode DEFAULT_DELIVERY_MODE
-
DEFAULT_PRIORITY
public static final Integer DEFAULT_PRIORITY
-
-
Method Detail
-
setHeaders
public void setHeaders(Map<String,Object> headers)
Set headers.- Parameters:
headers
- the headers.- Since:
- 2.4.7
-
getHeader
public <T> T getHeader(String headerName)
Typed getter for a header.- Type Parameters:
T
- the type.- Parameters:
headerName
- the header name.- Returns:
- the header value
- Since:
- 2.2
-
setTimestamp
public void setTimestamp(Date timestamp)
-
getTimestamp
public Date getTimestamp()
-
setMessageId
public void setMessageId(String messageId)
-
getMessageId
public String getMessageId()
-
setUserId
public void setUserId(String userId)
-
getUserId
public String getUserId()
-
getReceivedUserId
public String getReceivedUserId()
Return the user id from an incoming message.- Returns:
- the user id.
- Since:
- 1.6
-
setReceivedUserId
public void setReceivedUserId(String receivedUserId)
-
setAppId
public void setAppId(String appId)
-
getAppId
public String getAppId()
-
setClusterId
public void setClusterId(String clusterId)
-
getClusterId
public String getClusterId()
-
setType
public void setType(String type)
-
getType
public String getType()
-
setCorrelationId
public void setCorrelationId(String correlationId)
Set the correlation id.- Parameters:
correlationId
- the id.
-
getCorrelationId
public String getCorrelationId()
Get the correlation id.- Returns:
- the id.
-
setReplyTo
public void setReplyTo(String replyTo)
-
getReplyTo
public String getReplyTo()
-
setReplyToAddress
public void setReplyToAddress(Address replyTo)
-
getReplyToAddress
public Address getReplyToAddress()
-
setContentType
public void setContentType(String contentType)
-
getContentType
public String getContentType()
-
setContentEncoding
public void setContentEncoding(String contentEncoding)
-
getContentEncoding
public 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(String expiration)
-
getExpiration
public String getExpiration()
-
setPriority
public void setPriority(Integer priority)
-
getPriority
public Integer getPriority()
-
setReceivedExchange
public void setReceivedExchange(String receivedExchange)
-
getReceivedExchange
public String getReceivedExchange()
-
setReceivedRoutingKey
public void setReceivedRoutingKey(String receivedRoutingKey)
-
getReceivedRoutingKey
public String getReceivedRoutingKey()
-
getReceivedDelay
public 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(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(Boolean redelivered)
-
isRedelivered
public Boolean isRedelivered()
-
getRedelivered
public Boolean getRedelivered()
-
setDeliveryTag
public void setDeliveryTag(long deliveryTag)
-
getDeliveryTag
public long getDeliveryTag()
-
isDeliveryTagSet
protected final boolean isDeliveryTagSet()
-
setMessageCount
public void setMessageCount(Integer messageCount)
Set the message count.- Parameters:
messageCount
- the count- See Also:
getMessageCount()
-
getMessageCount
public 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 String getConsumerTag()
-
setConsumerTag
public void setConsumerTag(String consumerTag)
-
getConsumerQueue
public String getConsumerQueue()
-
setConsumerQueue
public void setConsumerQueue(String consumerQueue)
-
getDelay
public Integer getDelay()
The x-delay header (outbound).- Returns:
- the delay.
- Since:
- 1.6
- See Also:
getReceivedDelay()
-
setDelay
public void setDelay(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 Type getInferredArgumentType()
The inferred target argument type when using a method-level@RabbitListener
.- Returns:
- the type.
- Since:
- 1.6
-
setInferredArgumentType
public void setInferredArgumentType(Type inferredArgumentType)
Set the inferred target argument type when using a method-level@RabbitListener
.- Parameters:
inferredArgumentType
- the type.- Since:
- 1.6
-
getTargetMethod
public Method getTargetMethod()
The target method when using a@RabbitListener
.- Returns:
- the method.
- Since:
- 1.6
-
setTargetMethod
public void setTargetMethod(Method targetMethod)
Set the target method when using a@RabbitListener
.- Parameters:
targetMethod
- the target method.- Since:
- 1.6
-
getTargetBean
public Object getTargetBean()
The target bean when using@RabbitListener
.- Returns:
- the bean.
- Since:
- 1.6
-
setTargetBean
public void setTargetBean(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 List<Map<String,?>> getXDeathHeader()
Return the x-death header.- Returns:
- the header.
-
-