Package org.springframework.amqp.core
Class MessageProperties
java.lang.Object
org.springframework.amqp.core.MessageProperties
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StreamMessageProperties
Message Properties for an AMQP message.
- Author:
- Mark Fisher, Mark Pollack, Gary Russell, Dmitry Chernyshov, Artem Bilan, Csaba Soti
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final MessageDeliveryMode
static final Integer
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getAppId()
long
Get the correlation id.getDelay()
The x-delay header (outbound).long
Get the message expiration.<T> T
Typed getter for a header.The inferred target argument type when using a method-level@RabbitListener
.Return the server's most recent estimate of the number of messages remaining on the queue.long
Return the publish sequence number if publisher confirms are enabled; set by the template.When a delayed message exchange is used the x-delay header on a received message contains the delay.Return the user id from an incoming message.The target bean when using@RabbitListener
.The target method when using a@RabbitListener
.getType()
Return the x-death header.int
hashCode()
protected final boolean
protected final boolean
boolean
boolean
When true; the message having these properties is the last message from a batch.boolean
Get an internal flag used to communicate that conversion used projection; always false at the application level.void
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
Set the x-delay header.void
setDeliveryMode
(MessageDeliveryMode deliveryMode) void
setDeliveryTag
(long deliveryTag) void
setExpiration
(String expiration) Set the message expiration.void
setFinalRetryForMessageWithNoId
(boolean finalRetryForMessageWithNoId) void
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
void
toString()
-
Field Details
-
CONTENT_TYPE_BYTES
- See Also:
-
CONTENT_TYPE_TEXT_PLAIN
- See Also:
-
CONTENT_TYPE_SERIALIZED_OBJECT
- See Also:
-
CONTENT_TYPE_JSON
- See Also:
-
CONTENT_TYPE_JSON_ALT
- See Also:
-
CONTENT_TYPE_XML
- See Also:
-
SPRING_BATCH_FORMAT
- See Also:
-
BATCH_FORMAT_LENGTH_HEADER4
- See Also:
-
SPRING_AUTO_DECOMPRESS
- See Also:
-
X_DELAY
- See Also:
-
DEFAULT_CONTENT_TYPE
- See Also:
-
DEFAULT_DELIVERY_MODE
-
DEFAULT_PRIORITY
-
-
Constructor Details
-
MessageProperties
public MessageProperties()
-
-
Method Details
-
setHeader
-
setHeaders
Set headers.- Parameters:
headers
- the headers.- Since:
- 2.4.7
-
getHeader
Typed getter for a header.- Type Parameters:
T
- the type.- Parameters:
headerName
- the header name.- Returns:
- the header value
- Since:
- 2.2
-
getHeaders
-
setTimestamp
-
getTimestamp
-
setMessageId
-
getMessageId
-
setUserId
-
getUserId
-
getReceivedUserId
Return the user id from an incoming message.- Returns:
- the user id.
- Since:
- 1.6
-
setReceivedUserId
-
setAppId
-
getAppId
-
setClusterId
-
getClusterId
-
setType
-
getType
-
setCorrelationId
Set the correlation id.- Parameters:
correlationId
- the id.
-
getCorrelationId
Get the correlation id.- Returns:
- the id.
-
setReplyTo
-
getReplyTo
-
setReplyToAddress
-
getReplyToAddress
-
setContentType
-
getContentType
-
setContentEncoding
-
getContentEncoding
-
setContentLength
public void setContentLength(long contentLength) -
getContentLength
public long getContentLength() -
isContentLengthSet
protected final boolean isContentLengthSet() -
setDeliveryMode
-
getDeliveryMode
-
getReceivedDeliveryMode
-
setReceivedDeliveryMode
-
setExpiration
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
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
-
getPriority
-
setReceivedExchange
-
getReceivedExchange
-
setReceivedRoutingKey
-
getReceivedRoutingKey
-
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:
-
setReceivedDelay
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
-
isRedelivered
-
getRedelivered
-
setDeliveryTag
public void setDeliveryTag(long deliveryTag) -
getDeliveryTag
public long getDeliveryTag() -
isDeliveryTagSet
protected final boolean isDeliveryTagSet() -
setMessageCount
Set the message count.- Parameters:
messageCount
- the count- See Also:
-
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
-
setConsumerTag
-
getConsumerQueue
-
setConsumerQueue
-
getDelay
The x-delay header (outbound).- Returns:
- the delay.
- Since:
- 1.6
- See Also:
-
setDelay
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
The inferred target argument type when using a method-level@RabbitListener
.- Returns:
- the type.
- Since:
- 1.6
-
setInferredArgumentType
Set the inferred target argument type when using a method-level@RabbitListener
.- Parameters:
inferredArgumentType
- the type.- Since:
- 1.6
-
getTargetMethod
The target method when using a@RabbitListener
.- Returns:
- the method.
- Since:
- 1.6
-
setTargetMethod
Set the target method when using a@RabbitListener
.- Parameters:
targetMethod
- the target method.- Since:
- 1.6
-
getTargetBean
The target bean when using@RabbitListener
.- Returns:
- the bean.
- Since:
- 1.6
-
setTargetBean
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
Return the x-death header.- Returns:
- the header.
-
hashCode
public int hashCode() -
equals
-
toString
-