@azure/service-bus package

Classes

MessagingError

Describes the base class for Messaging Error.

ServiceBusAdministrationClient

All operations return promises that resolve to an object that has the relevant output. These objects also have a property called _response that you can use if you want to access the direct response from the service.

ServiceBusClient

A client that can create Sender instances for sending messages to queues and topics as well as Receiver instances to receive messages from queues and subscriptions.

ServiceBusError

Errors that occur within Service Bus.

Interfaces

AuthorizationRule

Represents type of AuthorizationRule in ATOM based management operations.

CorrelationRuleFilter

Represents the correlation filter expression. A CorrelationRuleFilter holds a set of conditions that are matched against user and system properties of incoming messages from a Subscription.

CreateMessageBatchOptions

Options to configure the createBatch method on the Sender.

  • maxSizeInBytes: The upper limit for the size of batch.

Example usage:

{
    maxSizeInBytes: 1024 * 1024 // 1 MB
}
CreateQueueOptions

Represents settable options on a queue

CreateSubscriptionOptions

Represents settable options on a subscription

CreateTopicOptions

Represents settable options on a topic

DeadLetterOptions

Describes the reason and error description for dead lettering a message using the deadLetter() method on the message received from Service Bus.

Delivery
GetMessageIteratorOptions

Options when getting an iterable iterator from Service Bus.

HttpHeader

An individual header within a HttpHeaders collection.

HttpHeadersLike

A collection of HTTP header key/value pairs.

HttpResponse

The properties on an HTTP response which will always be present.

MessageHandlers

The general message handler interface (used for streamMessages).

NamespaceProperties

Represents the metadata related to a service bus namespace.

OperationOptions

The base options type for all operations.

PeekMessagesOptions

Describes the options passed to the peekMessages method on a receiver.

ProcessErrorArgs

Arguments to the processError callback.

QueueProperties

Represents the input for updateQueue.

QueueRuntimeProperties

Represents runtime info attributes of a queue entity

ReceiveMessagesOptions

Options when receiving a batch of messages from Service Bus.

RetryOptions

Retry policy options that determine the mode, number of retries, retry interval etc.

RuleProperties

Represents all the attributes of a rule.

ServiceBusAdministrationClientOptions

Represents the client options of the ServiceBusAdministrationClient.

ServiceBusClientOptions

Describes the options that can be provided while creating the ServiceBusClient.

  • webSocketOptions : Options to configure the channelling of the AMQP connection over Web Sockets.
    • websocket : The WebSocket constructor used to create an AMQP connection if you choose to make the connection over a WebSocket.
    • webSocketConstructorOptions : Options to pass to the Websocket constructor when you choose to make the connection over a WebSocket.
  • retryOptions : The retry options for all the operations on the client.
    • maxRetries : The number of times the operation can be retried in case of a retryable error.
    • maxRetryDelayInMs: The maximum delay between retries. Applicable only when performing exponential retries.
    • mode: Which retry mode to apply, specified by the RetryMode enum. Options are Exponential and Fixed. Defaults to Fixed.
    • retryDelayInMs: Amount of time to wait in milliseconds before making the next attempt. When mode is set to Exponential, this is used to compute the exponentially increasing delays between retries. Default: 30000 milliseconds.
    • timeoutInMs: Amount of time in milliseconds to wait before the operation times out. This will trigger a retry if there are any retry attempts remaining. Minimum value: 60000 milliseconds.
ServiceBusConnectionStringProperties

The set of properties that comprise a Service Bus connection string.

ServiceBusMessage

Describes the message to be sent to Service Bus.

ServiceBusMessageBatch

A batch of messages that you can create using the <xref:createBatch> method.

ServiceBusReceivedMessage

Describes the message received from Service Bus during peek operations and so cannot be settled.

ServiceBusReceiver

A receiver that does not handle sessions.

ServiceBusReceiverOptions

Options to use when creating a receiver.

ServiceBusRuleManager

Allows rules for a subscription to be managed. This rule manager requires only Listen claims, whereas the ServiceBusAdministrationClient requires Manage claims.

ServiceBusSender

A Sender can be used to send messages, schedule messages to be sent at a later time and cancel such scheduled messages. Use the createSender function on the ServiceBusClient to instantiate a Sender. The Sender class is an abstraction over the underlying AMQP sender link.

ServiceBusSenderOptions

Options to use when creating a sender.

ServiceBusSessionReceiver

A receiver that handles sessions, including renewing the session lock.

ServiceBusSessionReceiverOptions

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

SqlRuleFilter

Represents all possible fields on SqlRuleFilter

SubscribeOptions

Options used when subscribing to a Service Bus queue or subscription.

SubscriptionProperties

Represents the input for updateSubscription.

SubscriptionRuntimeProperties

Represents runtime info attributes of a subscription entity

TokenCredential

Represents a credential capable of providing an authentication token.

TopicProperties

Represents the input for updateTopic.

TopicRuntimeProperties

Represents runtime info attributes of a topic entity

TryAddOptions

The set of options to manually propagate Span context for distributed tracing.

WebResourceLike

A description of a HTTP request to be made to a remote server.

WebSocketImpl

Describes the required shape of WebSocket constructors.

WebSocketOptions

Options to configure the channelling of the AMQP connection over Web Sockets.

Type Aliases

EntitiesResponse

Represents the result of list operation on entities which also contains the continuationToken to start iterating over from.

EntityAvailabilityStatus

Possible values for availabilityStatus of the Service Bus messaging entities.

EntityStatus

Possible values for status of the Service Bus messaging entities.

OperationOptionsBase

NOTE: This type is intended to mirror the relevant fields and structure from @azure/core-client OperationOptions

Options for configuring tracing and the abortSignal.

RawHttpHeaders

A HttpHeaders collection represented as a simple JSON object.

ServiceBusErrorCode

Service Bus failure codes.

SqlRuleAction

Represents all possible fields on SqlRuleAction

TransferProgressEvent

Fired in response to upload or download progress.

WithResponse

Represents the returned response of the operation along with the raw response.

Enums

RetryMode

Describes the Retry Mode type

TokenType

Describes the type of supported tokens.

Functions

delay<T>(number, AbortSignalLike, string, T)

A wrapper for setTimeout that resolves a promise after t milliseconds.

isServiceBusError(unknown)

Determines if an error is of type ServiceBusError

parseServiceBusConnectionString(string)

Parses given connection string into the different properties applicable to Azure Service Bus. The properties are useful to then construct a ServiceBusClient.

Function Details

delay<T>(number, AbortSignalLike, string, T)

A wrapper for setTimeout that resolves a promise after t milliseconds.

function delay<T>(delayInMs: number, abortSignal?: AbortSignalLike, abortErrorMsg?: string, value?: T): Promise<T | void>

Parameters

delayInMs

number

The number of milliseconds to be delayed.

abortSignal
AbortSignalLike

The abortSignal associated with containing operation.

abortErrorMsg

string

The abort error message associated with containing operation.

value

T

The value to be resolved with after a timeout of t milliseconds.

Returns

Promise<T | void>

  • Resolved promise

isServiceBusError(unknown)

Determines if an error is of type ServiceBusError

function isServiceBusError(err: unknown): err

Parameters

err

unknown

An error to check to see if it's of type ServiceBusError

Returns

err

parseServiceBusConnectionString(string)

Parses given connection string into the different properties applicable to Azure Service Bus. The properties are useful to then construct a ServiceBusClient.

function parseServiceBusConnectionString(connectionString: string): ServiceBusConnectionStringProperties

Parameters

connectionString

string

The connection string associated with the Shared Access Policy created for the Service Bus namespace, queue or topic.

Returns