public final class ServiceBusReceivedMessage extends Object
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
getApplicationProperties()
Gets the set of free-form
ServiceBusReceivedMessage properties which may be used for passing metadata
associated with the ServiceBusReceivedMessage during Service Bus operations. |
com.azure.core.util.BinaryData |
getBody()
Gets the payload wrapped by the
ServiceBusReceivedMessage. |
String |
getContentType()
Gets the content type of the message.
|
String |
getCorrelationId()
Gets a correlation identifier.
|
String |
getDeadLetterErrorDescription()
Gets the description for a message that has been dead-lettered.
|
String |
getDeadLetterReason()
Gets the reason a message was dead-lettered.
|
String |
getDeadLetterSource()
Gets the name of the queue or subscription that this message was enqueued on, before it was dead-lettered.
|
long |
getDeliveryCount()
Gets the number of the times this message was delivered to clients.
|
long |
getEnqueuedSequenceNumber()
Gets the enqueued sequence number assigned to a message by Service Bus.
|
OffsetDateTime |
getEnqueuedTime()
Gets the datetime at which this message was enqueued in Azure Service Bus.
|
OffsetDateTime |
getExpiresAt()
Gets the datetime at which this message will expire.
|
OffsetDateTime |
getLockedUntil()
Gets the datetime at which the lock of this message expires.
|
String |
getLockToken()
Gets the lock token for the current message.
|
String |
getMessageId()
Gets the identifier for the message.
|
String |
getPartitionKey()
Gets the partition key for sending a message to a partitioned entity.
|
com.azure.core.amqp.models.AmqpAnnotatedMessage |
getRawAmqpMessage()
The representation of message as defined by AMQP protocol.
|
String |
getReplyTo()
Gets the address of an entity to send replies to.
|
String |
getReplyToSessionId()
Gets or sets a session identifier augmenting the
ReplyTo address. |
OffsetDateTime |
getScheduledEnqueueTime()
Gets the scheduled enqueue time of this message.
|
long |
getSequenceNumber()
Gets the unique number assigned to a message by Service Bus.
|
String |
getSessionId()
Gets the session id of the message.
|
String |
getSubject()
Gets the subject for the message.
|
Duration |
getTimeToLive()
Gets the duration before this message expires.
|
String |
getTo()
Gets the "to" address.
|
public Map<String,Object> getApplicationProperties()
ServiceBusReceivedMessage properties which may be used for passing metadata
associated with the ServiceBusReceivedMessage during Service Bus operations. A common use-case for
properties() is to associate serialization hints for the ServiceBusReceivedMessage.getBody() as an aid to consumers
who wish to deserialize the binary data.ServiceBusReceivedMessage.ServiceBusMessage.getApplicationProperties()public com.azure.core.util.BinaryData getBody()
ServiceBusReceivedMessage.
The BinaryData wraps byte array and is an abstraction over many different ways it can be represented.
It provides convenience APIs to serialize/deserialize the object.
If the means for deserializing the raw data is not apparent to consumers, a common technique is to make use of
ServiceBusReceivedMessage.getApplicationProperties() when creating the event, to associate serialization hints as an aid to
consumers who wish to deserialize the binary data.
ServiceBusMessage.getBody()public String getContentType()
Optionally describes the payload of the message, with a descriptor following the format of RFC2045, Section 5, for example "application/json".
ServiceBusReceivedMessage.ServiceBusMessage.getContentType()public String getCorrelationId()
Allows an application to specify a context for the message for the purposes of correlation, for example reflecting the MessageId of a message that is being replied to.
ServiceBusMessage.getCorrelationId(),
Message
Routing and Correlationpublic String getDeadLetterErrorDescription()
null otherwise.public String getDeadLetterReason()
null otherwise.public String getDeadLetterSource()
This value is only set in messages that have been dead-lettered and subsequently auto-forwarded from the dead-letter queue to another entity.
null otherwise.public long getDeliveryCount()
The count is incremented when a message lock expires, or the message is explicitly abandoned by the receiver.
public long getEnqueuedSequenceNumber()
The sequence number is a unique 64-bit integer first assigned to a message as it is accepted at its original point of submission.
public OffsetDateTime getEnqueuedTime()
The UTC datetime at which the message has been accepted and stored in the entity. For scheduled messages, this reflects the time when the message was activated. This value can be used as an authoritative and neutral arrival time indicator when the receiver does not want to trust the sender's clock.
public OffsetDateTime getExpiresAt()
The value is the UTC datetime for when the message is scheduled for removal and will no longer available for
retrieval from the entity. Expiry is controlled by the time-to-live property. This
property is computed from enqueued time plus time-to-live.
OffsetDateTime at which this message expires.public String getLockToken()
The lock token is a reference to the lock that is being held by the broker in
ServiceBusReceiveMode.PEEK_LOCK mode. Locks are used to explicitly settle messages as explained in the
product
documentation. The token can also be used to pin the lock permanently through the
Deferral API and take the
message out of the regular delivery state flow. This property is read-only.
null for messages retrieved via
ServiceBusReceiveMode.RECEIVE_AND_DELETE mode.public OffsetDateTime getLockedUntil()
For messages retrieved under a lock (peek-lock receive mode, not pre-settled) this property reflects the UTC
datetime until which the message is held locked in the queue/subscription. When the lock expires, the
delivery count is incremented and the message is again available for retrieval.
This property is read-only.
ServiceBusReceiveMode.PEEK_LOCK mode. Otherwise it returns null.public String getMessageId()
The message identifier is an application-defined value that uniquely identifies the message and its payload. The
identifier is a free-form string and can reflect a GUID or an identifier derived from the application context. If
enabled, the
duplicate detection
feature identifies and removes second and further submissions of messages with the same messageId.
ServiceBusReceivedMessage.ServiceBusMessage.getMessageId()public String getPartitionKey()
For partitioned
entities, setting this value enables assigning related messages to the same internal partition, so that
submission sequence order is correctly recorded. The partition is chosen by a hash function over this value and
cannot be chosen directly. For session-aware entities, the sessionId property overrides
this value.
ServiceBusMessage.getPartitionKey()public com.azure.core.amqp.models.AmqpAnnotatedMessage getRawAmqpMessage()
AmqpAnnotatedMessage representing AMQP message.public String getReplyTo()
This optional and application-defined value is a standard way to express a reply path to the receiver of the message. When a sender expects a reply, it sets the value to the absolute or relative path of the queue or topic it expects the reply to be sent to.
public String getReplyToSessionId()
ReplyTo address.
This value augments the ReplyTo information and specifies which SessionId should be set for the reply when sent to the reply entity.
public OffsetDateTime getScheduledEnqueueTime()
This value is used for delayed message availability. The message is safely added to the queue, but is not considered active and therefore not retrievable until the scheduled enqueue time. Mind that the message may not be activated (enqueued) at the exact given datetime; the actual activation time depends on the queue's workload and its state.
public long getSequenceNumber()
The sequence number is a unique 64-bit integer assigned to a message as it is accepted and stored by the broker and functions as its true identifier. For partitioned entities, the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase and are gapless. They roll over to 0 when the 48-64 bit range is exhausted. This property is read-only.
public String getSessionId()
For session-aware entities, this application-defined value specifies the session affiliation of the message. Messages with the same session identifier are subject to summary locking and enable exact in-order processing and demultiplexing. For session-unaware entities, this value is ignored. See Message Sessions.
ServiceBusReceivedMessage.ServiceBusMessage.getSessionId()public String getSubject()
This property enables the application to indicate the purpose of the message to the receiver in a standardized fashion, similar to an email subject line. The mapped AMQP property is "subject".
ServiceBusMessage.getSubject()public Duration getTimeToLive()
This value is the relative duration after which the message expires, starting from the datetime the message has
been accepted and stored by the broker, as captured in ServiceBusReceivedMessage.getScheduledEnqueueTime(). When not set
explicitly, the assumed value is the DefaultTimeToLive set for the respective queue or topic. A message-level
TimeToLive value cannot be longer than the entity's DefaultTimeToLive setting and it is silently adjusted if it
does.
public String getTo()
This property is reserved for future use in routing scenarios and presently ignored by the broker itself. Applications can use this value in rule-driven auto-forward chaining scenarios to indicate the intended logical destination of the message.
ServiceBusMessage.getTo()Visit the Azure for Java Developers site for more Java documentation, including quick starts, tutorials, and code samples.