ServiceBusSessionReceiverOptions interface

Describes the options passed to the acceptSession and acceptNextSession methods when using a Queue/Subscription that has sessions enabled.

Extends

Properties

identifier

Sets the name to identify the session receiver. This can be used to correlate logs and exceptions. If not specified or empty, a random unique one will be used.

maxAutoLockRenewalDurationInMs

The maximum duration, in milliseconds, that the lock on the session will be renewed automatically by the client.

  • Default: 300000 milliseconds (5 minutes).
  • To disable autolock renewal, set this to 0.

Example:

If the lock expires in 2 minutes and your processing time is 8 minutes...

Set maxAutoLockRenewalDurationInMs to 10 minutes, and the lock will be automatically renewed about 4 times (equivalent to having the session locked for 4 times its lock duration by leveraging the lock renewals).

receiveMode

Represents the receive mode for the receiver.

In receiveAndDelete mode, messages are deleted from Service Bus as they are received.

In peekLock mode, the receiver has a lock on the message for the duration specified on the queue/subscription.

Messages that are not settled within the lock duration will be redelivered as many times as the max delivery count set on the queue/subscription, after which they get sent to a separate dead letter queue.

You can settle a message by calling complete(), abandon(), defer() or deadletter() methods on the message.

More information about how peekLock and message settlement works here: https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock

skipConvertingDate

Whether to skip converting Date type on properties of message annotations or application properties into numbers when receiving the message. By default, properties of Date type is converted into UNIX epoch number for compatibility.

skipParsingBodyAsJson

Option to disable the client from running JSON.parse() on the message body when receiving the message. Not applicable if the message was sent with AMQP body type value or sequence. Use this option when you prefer to work directly with the bytes present in the message body than have the client attempt to parse it.

Inherited Properties

abortSignal

The signal which can be used to abort requests.

tracingOptions

Options used when tracing is enabled.

Property Details

identifier

Sets the name to identify the session receiver. This can be used to correlate logs and exceptions. If not specified or empty, a random unique one will be used.

identifier?: string

Property Value

string

maxAutoLockRenewalDurationInMs

The maximum duration, in milliseconds, that the lock on the session will be renewed automatically by the client.

  • Default: 300000 milliseconds (5 minutes).
  • To disable autolock renewal, set this to 0.

Example:

If the lock expires in 2 minutes and your processing time is 8 minutes...

Set maxAutoLockRenewalDurationInMs to 10 minutes, and the lock will be automatically renewed about 4 times (equivalent to having the session locked for 4 times its lock duration by leveraging the lock renewals).

maxAutoLockRenewalDurationInMs?: number

Property Value

number

receiveMode

Represents the receive mode for the receiver.

In receiveAndDelete mode, messages are deleted from Service Bus as they are received.

In peekLock mode, the receiver has a lock on the message for the duration specified on the queue/subscription.

Messages that are not settled within the lock duration will be redelivered as many times as the max delivery count set on the queue/subscription, after which they get sent to a separate dead letter queue.

You can settle a message by calling complete(), abandon(), defer() or deadletter() methods on the message.

More information about how peekLock and message settlement works here: https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock

receiveMode?: "peekLock" | "receiveAndDelete"

Property Value

"peekLock" | "receiveAndDelete"

skipConvertingDate

Whether to skip converting Date type on properties of message annotations or application properties into numbers when receiving the message. By default, properties of Date type is converted into UNIX epoch number for compatibility.

skipConvertingDate?: boolean

Property Value

boolean

skipParsingBodyAsJson

Option to disable the client from running JSON.parse() on the message body when receiving the message. Not applicable if the message was sent with AMQP body type value or sequence. Use this option when you prefer to work directly with the bytes present in the message body than have the client attempt to parse it.

skipParsingBodyAsJson?: boolean

Property Value

boolean

Inherited Property Details

abortSignal

The signal which can be used to abort requests.

abortSignal?: AbortSignalLike

Property Value

Inherited From OperationOptionsBase.abortSignal

tracingOptions

Options used when tracing is enabled.

tracingOptions?: OperationTracingOptions

Property Value

Inherited From OperationOptionsBase.tracingOptions