Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ServiceBusClient

Package version

Describes the client that allows interacting with a Service Bus instance. Holds the AMQP connection to the Service Bus Namespace and is the entry point for using Queues, Topics and Subscriptions.

Hierarchy

  • ServiceBusClient

Index

Properties

name

name: string
readonly
property

The name of the Service Bus Namespace.

Methods

close

  • close(): Promise<any>
  • Closes the AMQP connection created by this ServiceBusClient along with AMQP links for sender/receivers created by the queue/topic/subscription clients created by this ServiceBusClient. Once closed,

    • the clients created by this ServiceBusClient cannot be used to send/receive messages anymore.
    • this ServiceBusClient cannot be used to create any new queues/topics/subscriptions clients.

    Returns Promise<any>

createQueueClient

createSubscriptionClient

  • createSubscriptionClient(topicName: string, subscriptionName: string): SubscriptionClient

createTopicClient

Static createFromAadTokenCredentials

  • Creates a ServiceBusClient for the Service Bus Namespace represented by the given host using the TokenCredentials generated using the @azure/ms-rest-nodeauth library.

    throws

    Error if createFromAadTokenCredentials is accessed in browser context, as AAD support is not present in browser.

    Parameters

    • host: string

      Fully qualified domain name for ServiceBus. Most likely, {yournamespace}.servicebus.windows.net

    • credentials: { getToken: any }

      The Token credentials generated by using the @azure/ms-rest-nodeauth library. It can be one of the following:

      • ApplicationTokenCredentials
      • UserTokenCredentials
      • DeviceTokenCredentials
      • MSITokenCredentials Token audience (or resource in case of MSI based credentials) to use when creating the credentials is https://servicebus.azure.net/
    • Optional options: ServiceBusClientOptions

      Options to control ways to interact with the Service Bus Namespace.

    Returns ServiceBusClient

Static createFromConnectionString

Static createFromTokenProvider

  • Creates a ServiceBusClient for the Service Bus Namespace represented by the given host using the given TokenProvider. If you're using an own token provider against AAD, then set the "scopes" for service-bus to be ["https://servicebus.azure.net//user_impersonation"] to get the appropriate token.

    Parameters

    • host: string

      Fully qualified domain name for Servicebus. Most likely, <yournamespace>.servicebus.windows.net.

    • tokenProvider: TokenProvider

      Your custom implementation of the Token Provider interface.

    • Optional options: ServiceBusClientOptions

      Options to control ways to interact with the Service Bus Namespace.

    Returns ServiceBusClient

Generated using TypeDoc