CbsClient class

Properties

cbsLock

The unqiue lock name per $cbs session per connection that is used to acquire the lock for establishing a cbs session if one does not exist for an aqmp connection.

connection

The AMQP connection.

connectionLock

The unqiue lock name per connection that is used to acquire the lock for establishing an amqp connection if one does not exist.

endpoint

CBS endpoint - "$cbs"

replyTo

CBS replyTo - The reciever link name that the service should reply to.

Methods

close()

Closes the AMQP cbs session to the EventHub/ServiceBus for this client, returning a promise that will be resolved when disconnection is completed.

init()

Creates a singleton instance of the CBS session if it hasn't been initialized previously on the given connection.

negotiateClaim(string, TokenInfo)

Negotiates the CBS claim with the EventHub/ServiceBus Service.

remove()

Removes the AMQP cbs session to the EventHub/ServiceBus for this client,

Constructor Details

CbsClient(Connection, string)

new CbsClient(connection: Connection, connectionLock: string)

Parameters

connection

Connection

The AMQP conection.

connectionLock

string

A unique string (usually a guid) per connection.

Property Details

cbsLock

The unqiue lock name per $cbs session per connection that is used to acquire the lock for establishing a cbs session if one does not exist for an aqmp connection.

cbsLock: string

Property Value

string

connection

The AMQP connection.

connection: Connection

Property Value

Connection

connectionLock

The unqiue lock name per connection that is used to acquire the lock for establishing an amqp connection if one does not exist.

connectionLock: string

Property Value

string

endpoint

CBS endpoint - "$cbs"

endpoint: string

Property Value

string

replyTo

CBS replyTo - The reciever link name that the service should reply to.

replyTo: string

Property Value

string

Method Details

close()

Closes the AMQP cbs session to the EventHub/ServiceBus for this client, returning a promise that will be resolved when disconnection is completed.

function close(): Promise<void>

Returns

Promise<void>

init()

Creates a singleton instance of the CBS session if it hasn't been initialized previously on the given connection.

function init(): Promise<void>

Returns

Promise<void>

Promise<void>.

negotiateClaim(string, TokenInfo)

Negotiates the CBS claim with the EventHub/ServiceBus Service.

function negotiateClaim(audience: string, tokenObject: TokenInfo): Promise<CbsResponse>

Parameters

audience

string

The entity token audience for which the token is requested in one of the following forms:

  • ServiceBus

    • Sender

      • "sb://<yournamespace>.servicebus.windows.net/<queue-name>"
      • "sb://<yournamespace>.servicebus.windows.net/<topic-name>"
    • Receiver - "sb://<yournamespace>.servicebus.windows.net/<queue-name>" - "sb://<yournamespace>.servicebus.windows.net/<topic-name>"

    • ManagementClient - "sb://<your-namespace>.servicebus.windows.net/<queue-name>/$management". - "sb://<your-namespace>.servicebus.windows.net/<topic-name>/$management".

  • EventHubs

    • Sender

      • "sb://<yournamespace>.servicebus.windows.net/<hubName>"
      • "sb://<yournamespace>.servicebus.windows.net/<hubName>/Partitions/<partitionId>".
    • Receiver

      • "sb://<your-namespace>.servicebus.windows.net/<event-hub-name>/ConsumerGroups/<consumer-group-name>/Partitions/<partition-id>".
    • ManagementClient

      • "sb://<your-namespace>.servicebus.windows.net/<event-hub-name>/$management".
tokenObject
TokenInfo

The token object that needs to be sent in the put-token request.

Returns

Promise<CbsResponse>

Returns a Promise that resolves when $cbs authentication is successful and rejects when an error occurs during $cbs authentication.

remove()

Removes the AMQP cbs session to the EventHub/ServiceBus for this client,

function remove()