Share via


@azure/amqp-common package

Classes

AsyncLock
AadTokenProvider

Defines the AAD (Azure ActiveDirectory) TokenProvider. This accepts the following credentials from the @azure/ms-rest-nodeauth package:

  • ApplicationTokenCredentials
  • UserTokenCredentials
  • DeviceTokenCredentials
  • MSITokenCredentials (MSIVmTokenCredentials)
CbsClient
DefaultDataTransformer

The default data transformer that will be used by the Azure SDK.

MessagingError

Describes the base class for Messaging Error.

RequestResponseLink

Describes an amqp request(sender)-response(receiver) link that is created over an amqp session.

SasTokenProvider
Timeout

Describes a Timeout class that can wait for the specified amount of time and then resolve/reject the promise with the given value.

Interfaces

AsyncLockOptions
ConnectionConfig

Describes the connection config object that is created after parsing an EventHub or ServiceBus connection string.

ConnectionContextBase
EventHubConnectionConfig

Describes the connection config object that is created after parsing an EventHub connection string. It also provides some convenience methods for getting the address and audience for different entities.

MessageHeader

Describes the defined set of standard header properties of the message.

MessageProperties

Describes the defined set of standard properties of the message.

AmqpMessage

Describes the AMQP message that is sent or received on the wire.

AmqpMessageHeader

Describes the defined set of standard header properties of the message.

AmqpMessageProperties

Describes the defined set of standard properties of the message.

AsyncLockOptions

Describes the options that can be provided to create an async lock.

CbsResponse

Describes the CBS Response.

ConnectionConfigOptions

Describes the options that can be provided while creating a connection config.

ConnectionProperties

Defines the properties that need to be set while establishing the AMQP connection.

CreateConnectionContextBaseParameters

Describes the parameters that can be provided to create the base connection context.

DataTransformer

Describes the transformations that can be performed to encode/decode the data before sending it on (or receiving it from) the wire.

Dictionary

Provides a Dictionary like structure <Key, Value> of Type T.

EventHubConnectionStringModel

Describes the eventhub connection string model.

IotHubConnectionStringModel

Describes the iothub connection string model.

RetryConfig

Describes the parameters that need to be configured for the retry operation.

SendRequestOptions

Describes the options that can be specified while sending a request.

ServiceBusConnectionStringModel

Describes the servicebus connection string model.

StorageConnectionStringModel

Describes the stroage connection string model.

TokenInfo

Provides information about the token.

TokenProvider

Describes the base token provider.

Type Aliases

AsyncLockDoneCallback
Func

Type declaration for a Function type where T is the input to the function and V is the output of the function.

ParsedOutput

Defines an object with possible properties defined in T.

Enums

ConditionErrorNameMapper

Maps the amqp error conditions to the Error names.

ConditionStatusMapper

Maps the conditions to the numeric AMQP Response status codes.

ErrorNameConditionMapper

Maps the Error names to the amqp error conditions.

RetryOperationType

Describes the retry operation type. RetryOperationType

SystemErrorConditionMapper

Maps some SytemErrors to amqp error conditions SystemErrorConditionMapper

TokenType

Describes the type of supported tokens. TokenType

Functions

delay<T>(number, T)

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

executePromisesSequentially(any[], any)
getNewAsyncLock(AsyncLockOptions)

Gets a new instance of the async lock with desired settings.

isAmqpError(any)

Determines whether the given error object is like an AmqpError object.

isIotHubConnectionString(string)

Determines whether the given connection string is an iothub connection string.

isSystemError(any)
parseConnectionString<T>(string)

Parses the connection string and returns an object of type T.

Connection strings have the following syntax:

ConnectionString ::= Part { ";" Part } [ ";" ] [ WhiteSpace ] Part ::= [ PartLiteral [ "=" PartLiteral ] ] PartLiteral ::= [ WhiteSpace ] Literal [ WhiteSpace ] Literal ::= ? any sequence of characters except ; or = or WhiteSpace ? WhiteSpace ::= ? all whitespace characters including \r and \n ?

randomNumberFromInterval(number, number)

Generates a random number between the given interval

retry<T>(RetryConfig<T>)

It will attempt to linearly retry an operation specified number of times with a specified delay in between each retry. The retries will only happen if the error is retryable.

translate(Error | AmqpError)

Translates the AQMP error received at the protocol layer or a generic Error into a MessagingError.

Function Details

delay<T>(number, T)

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

function delay<T>(t: number, value?: T): Promise<T>

Parameters

t

number

The number of milliseconds to be delayed.

value

T

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

Returns

Promise<T>

  • Resolved promise

executePromisesSequentially(any[], any)

function executePromisesSequentially(promiseFactories: any[], kickstart?: any): Promise<any>

Parameters

promiseFactories

any[]

kickstart

any

Returns

Promise<any>

getNewAsyncLock(AsyncLockOptions)

Gets a new instance of the async lock with desired settings.

function getNewAsyncLock(options?: AsyncLockOptions): AsyncLock

Parameters

options
AsyncLockOptions

The async lock options.

Returns

AsyncLock

isAmqpError(any)

Determines whether the given error object is like an AmqpError object.

function isAmqpError(err: any): boolean

Parameters

err

any

The AmqpError object

Returns

boolean

result - true if it is an AMQP Error; false otherwise.

isIotHubConnectionString(string)

Determines whether the given connection string is an iothub connection string.

function isIotHubConnectionString(connectionString: string): boolean

Parameters

connectionString

string

The connection string.

Returns

boolean

boolean.

isSystemError(any)

function isSystemError(err: any): boolean

Parameters

err

any

Returns

boolean

parseConnectionString<T>(string)

Parses the connection string and returns an object of type T.

Connection strings have the following syntax:

ConnectionString ::= Part { ";" Part } [ ";" ] [ WhiteSpace ] Part ::= [ PartLiteral [ "=" PartLiteral ] ] PartLiteral ::= [ WhiteSpace ] Literal [ WhiteSpace ] Literal ::= ? any sequence of characters except ; or = or WhiteSpace ? WhiteSpace ::= ? all whitespace characters including \r and \n ?

function parseConnectionString<T>(connectionString: string): ParsedOutput<T>

Parameters

connectionString

string

The connection string to be parsed.

Returns

ParsedOutput<T>.

randomNumberFromInterval(number, number)

Generates a random number between the given interval

function randomNumberFromInterval(min: number, max: number): number

Parameters

min

number

Min number of the range (inclusive).

max

number

Max number of the range (inclusive).

Returns

number

retry<T>(RetryConfig<T>)

It will attempt to linearly retry an operation specified number of times with a specified delay in between each retry. The retries will only happen if the error is retryable.

function retry<T>(config: RetryConfig<T>): Promise<T>

Parameters

config

RetryConfig<T>

Parameters to configure retry operation.

Returns

Promise<T>

Promise<T>.

translate(Error | AmqpError)

Translates the AQMP error received at the protocol layer or a generic Error into a MessagingError.

function translate(err: Error | AmqpError): MessagingError

Parameters

err

Error | AmqpError

The amqp error that was received.

Returns

MessagingError object.