Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ServiceBusMessage

Package version

Describes the message received from Service Bus.

Hierarchy

  • ServiceBusMessage

Implements

Index

Properties

_amqpMessage

_amqpMessage: AmqpMessage
property

{AmqpMessage} _amqpMessage The underlying raw amqp message.

readonly

body

body: any
property

The message body that needs to be sent or is received.

Optional contentType

contentType: undefined | string
property

The content type of the message. Optionally describes the payload of the message, with a descriptor following the format of RFC2045, Section 5, for example "application/json".

Optional correlationId

correlationId: string | number | Buffer
property

The correlation identifier that 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. See Message Routing and Correlation.

Optional deadLetterSource

deadLetterSource: undefined | string
property

The name of the queue or subscription that this message was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the entity in which the message was dead-lettered.

readonly

delivery

delivery: Delivery

The associated delivery of the received message.

Optional deliveryCount

deliveryCount: undefined | number
property

Number of deliveries that have been attempted for this message. The count is incremented when a message lock expires, or the message is explicitly abandoned using the abandon() method on the message.

readonly

Optional enqueuedSequenceNumber

enqueuedSequenceNumber: undefined | number
property

The original sequence number of the message. For messages that have been auto-forwarded, this property reflects the sequence number that had first been assigned to the message at its original point of submission.

readonly

Optional enqueuedTimeUtc

enqueuedTimeUtc: Date
property

The UTC instant at which the message has been accepted and stored in Service Bus.

readonly

Optional expiresAtUtc

expiresAtUtc: Date
property

The UTC instant at which the message is marked for removal and no longer available for retrieval from the entity due to expiration. This property is computed from 2 other properties on the message: enqueuedTimeUtc + timeToLive.

Optional label

label: undefined | string
property

The application specific label. 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".

Optional lockToken

lockToken: undefined | string
property

The lock token is a reference to the lock that is being held by the broker in ReceiveMode.PeekLock mode. Locks are used internally settle messages as explained in the product documentation in more detail

  • Not applicable when the message is received in ReceiveMode.receiveAndDelete mode.
readonly

Optional lockedUntilUtc

lockedUntilUtc: Date
property

The UTC instant until which the message is held locked in the queue/subscription. When the lock expires, the deliveryCount is incremented and the message is again available for retrieval.

  • Not applicable when the message is received in ReceiveMode.receiveAndDelete mode.

Optional messageId

messageId: string | number | Buffer
property

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 identifies and removes second and further submissions of messages with the same MessageId.

Optional partitionKey

partitionKey: undefined | string
property

The partition key for sending a message to a partitioned entity. Maximum length is 128 characters. 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.

Optional replyTo

replyTo: undefined | string
property

The address of an entity to send replies to. 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. See Message Routing and Correlation.

Optional replyToSessionId

replyToSessionId: undefined | string
property

The session identifier augmenting the replyTo address. Maximum length is 128 characters. This value augments the ReplyTo information and specifies which SessionId should be set for the reply when sent to the reply entity. See Message Routing and Correlation.

Optional scheduledEnqueueTimeUtc

scheduledEnqueueTimeUtc: Date
property

The date and time in UTC at which the message will be enqueued. This property returns the time in UTC; when setting the property, the supplied DateTime value must also be in UTC. This value is for delayed message sending. It is utilized to delay messages sending to a specific time in the future. Message enqueuing time does not mean that the message will be sent at the same time. It will get enqueued, but the actual sending time depends on the queue's workload and its state.

Optional sequenceNumber

sequenceNumber: Long
property

The unique number assigned to a message by Service Bus. 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. They roll over to 0 when the 48-64 bit range is exhausted.

readonly

Optional sessionId

sessionId: undefined | string
property

The session identifier for a session-aware entity. Maximum length is 128 characters. 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. Message Sessions.

Optional timeToLive

timeToLive: undefined | number
property

The message’s time to live value. This value is the relative duration after which the message expires, starting from the instant the message has been accepted and stored by the broker, as captured in enqueuedTimeUtc. When not set explicitly, the assumed value is the DefaultTimeToLive 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. See Expiration.

Optional to

to: undefined | string
property

The "to" address. 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.

Optional userProperties

userProperties: undefined | {}
property

The application specific properties.

Optional viaPartitionKey

viaPartitionKey: undefined | string
property

The partition key for sending a message into an entity via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a transfer queue in the scope of a transaction, this value selects the transfer queue partition: This is functionally equivalent to partitionKey property and ensures that messages are kept together and in order as they are transferred. See Transfers and Send Via.

Accessors

isSettled

  • get isSettled(): boolean

Methods

abandon

  • abandon(propertiesToModify?: undefined | {}): Promise<void>
  • The lock held on the message by the receiver is let go, making the message available again in Service Bus for another receive operation.

    throws

    Error with name SessionLockLostError (for messages from a Queue/Subscription with sessions enabled) if the AMQP link with which the message was received is no longer alive. This can happen either because the lock on the session expired or the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error with name MessageLockLostError (for messages from a Queue/Subscription with sessions not enabled) if the lock on the message has expired or the AMQP link with which the message was received is no longer alive. The latter can happen if the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error if the message is already settled. To avoid this error check the isSettled property on the message if you are not sure whether the message is settled.

    throws

    Error if used in ReceiveAndDelete mode because all messages received in this mode are pre-settled. To avoid this error, update your code to not settle a message which is received in this mode.

    throws

    Error with name ServiceUnavailableError if Service Bus does not acknowledge the request to settle the message in time. The message may or may not have been settled successfully.

    Parameters

    • Optional propertiesToModify: undefined | {}

      The properties of the message to modify while abandoning the message.

    Returns Promise<void>

    Promise.

clone

complete

  • complete(): Promise<void>
  • Removes the message from Service Bus.

    throws

    Error with name SessionLockLostError (for messages from a Queue/Subscription with sessions enabled) if the AMQP link with which the message was received is no longer alive. This can happen either because the lock on the session expired or the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error with name MessageLockLostError (for messages from a Queue/Subscription with sessions not enabled) if the lock on the message has expired or the AMQP link with which the message was received is no longer alive. The latter can happen if the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error if the message is already settled. To avoid this error check the isSettled property on the message if you are not sure whether the message is settled.

    throws

    Error if used in ReceiveAndDelete mode because all messages received in this mode are pre-settled. To avoid this error, update your code to not settle a message which is received in this mode.

    throws

    Error with name ServiceUnavailableError if Service Bus does not acknowledge the request to settle the message in time. The message may or may not have been settled successfully.

    Returns Promise<void>

    Promise.

deadLetter

  • Moves the message to the deadletter sub-queue. To receive a deadletted message, create a new QueueClient/SubscriptionClient using the path for the deadletter sub-queue.

    throws

    Error with name SessionLockLostError (for messages from a Queue/Subscription with sessions enabled) if the AMQP link with which the message was received is no longer alive. This can happen either because the lock on the session expired or the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error with name MessageLockLostError (for messages from a Queue/Subscription with sessions not enabled) if the lock on the message has expired or the AMQP link with which the message was received is no longer alive. The latter can happen if the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error if the message is already settled. To avoid this error check the isSettled property on the message if you are not sure whether the message is settled.

    throws

    Error if used in ReceiveAndDelete mode because all messages received in this mode are pre-settled. To avoid this error, update your code to not settle a message which is received in this mode.

    throws

    Error with name ServiceUnavailableError if Service Bus does not acknowledge the request to settle the message in time. The message may or may not have been settled successfully.

    Parameters

    Returns Promise<void>

    Promise

defer

  • defer(propertiesToModify?: undefined | {}): Promise<void>
  • Defers the processing of the message. Save the sequenceNumber of the message, in order to receive it message again in the future using the receiveDeferredMessage method.

    throws

    Error with name SessionLockLostError (for messages from a Queue/Subscription with sessions enabled) if the AMQP link with which the message was received is no longer alive. This can happen either because the lock on the session expired or the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error with name MessageLockLostError (for messages from a Queue/Subscription with sessions not enabled) if the lock on the message has expired or the AMQP link with which the message was received is no longer alive. The latter can happen if the receiver was explicitly closed by the user or the AMQP link got closed by the library due to network loss or service error.

    throws

    Error if the message is already settled. To avoid this error check the isSettled property on the message if you are not sure whether the message is settled.

    throws

    Error if used in ReceiveAndDelete mode because all messages received in this mode are pre-settled. To avoid this error, update your code to not settle a message which is received in this mode.

    throws

    Error with name ServiceUnavailableError if Service Bus does not acknowledge the request to settle the message in time. The message may or may not have been settled successfully.

    Parameters

    • Optional propertiesToModify: undefined | {}

      The properties of the message to modify while deferring the message

    Returns Promise<void>

    Promise

Generated using TypeDoc