IServiceBusMessageActions interface

Provides actions for settling and managing messages in Azure Service Bus via gRPC.

This class wraps gRPC client calls to perform message settlement operations such as complete, abandon, deadletter, defer, as well as session management operations like renewing locks, setting session state, and releasing sessions.

Remarks

  • Requires a gRPC server implementing the Settlement service as defined in the proto file.
  • All methods throw if the required parameters are missing or if the gRPC call fails.

Methods

abandon(ServiceBusReceivedMessage, Record<string, any>)

Abandons the specified message, making it available again for processing.

complete(ServiceBusReceivedMessage)

Completes (settles) the specified message, removing it from the queue or subscription.

deadletter(ServiceBusReceivedMessage, Record<string, any>, string, string)

Deadletters the specified message, moving it to the dead-letter queue.

defer(ServiceBusReceivedMessage, Record<string, any>)

Defers the specified message, making it invisible until retrieved by sequence number.

releaseSession(string)

Releases the specified session, making it available for other receivers.

renewMessageLock(ServiceBusReceivedMessage)

Renews the lock on the specified message, extending its lock duration.

renewSessionLock(string)

Renews the lock on the specified session, extending its lock duration.

setSessionState(string, Uint8Array)

Sets the state for the specified session.

Method Details

abandon(ServiceBusReceivedMessage, Record<string, any>)

Abandons the specified message, making it available again for processing.

function abandon(message: ServiceBusReceivedMessage, propertiesToModify?: Record<string, any>): Promise<void>

Parameters

message
ServiceBusReceivedMessage

The received Service Bus message to abandon.

propertiesToModify

Record<string, any>

Optional properties to modify on the message.

Returns

Promise<void>

A promise that resolves when the operation is successful.

complete(ServiceBusReceivedMessage)

Completes (settles) the specified message, removing it from the queue or subscription.

function complete(message: ServiceBusReceivedMessage): Promise<void>

Parameters

message
ServiceBusReceivedMessage

The received Service Bus message to complete.

Returns

Promise<void>

A promise that resolves when the operation is successful.

deadletter(ServiceBusReceivedMessage, Record<string, any>, string, string)

Deadletters the specified message, moving it to the dead-letter queue.

function deadletter(message: ServiceBusReceivedMessage, propertiesToModify?: Record<string, any>, deadletterReason?: string, deadletterErrorDescription?: string): Promise<void>

Parameters

message
ServiceBusReceivedMessage

The received Service Bus message to deadletter.

propertiesToModify

Record<string, any>

Optional properties to modify on the message.

deadletterReason

string

Optional reason for deadlettering the message.

deadletterErrorDescription

string

Optional error description for deadlettering.

Returns

Promise<void>

A promise that resolves when the operation is successful.

defer(ServiceBusReceivedMessage, Record<string, any>)

Defers the specified message, making it invisible until retrieved by sequence number.

function defer(message: ServiceBusReceivedMessage, propertiesToModify?: Record<string, any>): Promise<void>

Parameters

message
ServiceBusReceivedMessage

The received Service Bus message to defer.

propertiesToModify

Record<string, any>

Optional properties to modify on the message.

Returns

Promise<void>

A promise that resolves when the operation is successful.

releaseSession(string)

Releases the specified session, making it available for other receivers.

function releaseSession(sessionId: string): Promise<void>

Parameters

sessionId

string

The session ID to release.

Returns

Promise<void>

A promise that resolves when the operation is successful.

renewMessageLock(ServiceBusReceivedMessage)

Renews the lock on the specified message, extending its lock duration.

function renewMessageLock(message: ServiceBusReceivedMessage): Promise<void>

Parameters

message
ServiceBusReceivedMessage

The received Service Bus message whose lock should be renewed.

Returns

Promise<void>

A promise that resolves when the operation is successful.

renewSessionLock(string)

Renews the lock on the specified session, extending its lock duration.

function renewSessionLock(sessionId: string): Promise<Date>

Parameters

sessionId

string

The session ID whose lock should be renewed.

Returns

Promise<Date>

A promise that resolves to the new locked-until date.

setSessionState(string, Uint8Array)

Sets the state for the specified session.

function setSessionState(sessionId: string, sessionState: Uint8Array): Promise<void>

Parameters

sessionId

string

The session ID for which to set the state.

sessionState

Uint8Array

The state to set for the session.

Returns

Promise<void>

A promise that resolves when the operation is successful.