@azure/core-amqp package
Classes
CbsClient |
Describes the EventHub/ServiceBus Cbs client that talks to the $cbs endpoint over AMQP connection. |
MessagingError |
Describes the base class for Messaging Error. |
RequestResponseLink |
Describes an amqp request(sender)-response(receiver) link that is created over an amqp session. |
Interfaces
AcquireLockProperties |
Describes the properties that must be provided while acquiring a lock. |
AmqpAnnotatedMessage |
Describes the AmqpAnnotatedMessage, part of the ServiceBusReceivedMessage(as |
AmqpMessageHeader |
Describes the defined set of standard header properties of the message. |
AmqpMessageProperties |
Describes the defined set of standard properties of the message. |
CancellableAsyncLock |
CancellableAsyncLock provides a mechanism for forcing tasks using the same 'key' to be executed serially. Pending tasks can be manually cancelled via an abortSignal or automatically cancelled by reach a provided timeout value. |
CbsResponse |
Describes the CBS Response. |
ConnectionConfig |
Describes the connection config object that is created after parsing an EventHub or ServiceBus connection string. |
ConnectionConfigOptions |
Describes the options that can be provided while creating a connection config. |
ConnectionContextBase |
Provides contextual information like the underlying amqp connection, cbs session, tokenProvider, Connection config, data transformer, etc. |
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. |
NetworkSystemError |
Describes the fields on a Node.js SystemError. Omits fields that are not related to network calls (e.g. file system calls). See https://nodejs.org/dist/latest-v12.x/docs/api/errors.html#errors_class_systemerror |
RetryConfig |
Describes the parameters that need to be configured for the retry operation. |
RetryOptions |
Retry policy options that determine the mode, number of retries, retry interval etc. |
SendRequestOptions |
Describes the options that can be specified while sending a request. |
WebSocketOptions |
Options to configure the channelling of the AMQP connection over Web Sockets. |
Type Aliases
ParsedOutput |
Defines an object with possible properties defined in T. |
Enums
ConditionErrorNameMapper |
Maps the amqp error conditions to the Error names. |
ErrorNameConditionMapper |
Maps the Error names to the amqp error conditions. |
RetryMode |
Describes the Retry Mode type |
RetryOperationType |
Describes the retry operation type. |
SystemErrorConditionMapper |
Maps some SystemErrors to amqp error conditions |
TokenType |
Describes the type of supported tokens. |
Functions
delay<T>(number, Abort |
A wrapper for setTimeout that resolves a promise after t milliseconds. |
is |
Determines if an error is a MessagingError. |
is |
Checks whether the provided error is a node.js SystemError. |
parse |
Parses the connection string and returns an object of type T. Connection strings have the following syntax: ConnectionString ::= |
retry<T>(Retry |
Every operation is attempted at least once. Additional attempts are made if the previous attempt failed
with a retryable error. The number of additional attempts is governed by the If If |
translate(unknown) | Translates the AMQP error received at the protocol layer or a SystemError into a MessagingError. All other errors are returned unaltered. |
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
isMessagingError(MessagingError | Error)
Determines if an error is a MessagingError.
function isMessagingError(error: MessagingError | Error): error
Parameters
- error
-
MessagingError | Error
An error that can either be an Error or a MessagingError.
Returns
error
isSystemError(unknown)
Checks whether the provided error is a node.js SystemError.
function isSystemError(err: unknown): err
Parameters
- err
-
unknown
An object that may contain error information.
Returns
err
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>
ParsedOutput.
retry<T>(RetryConfig<T>)
Every operation is attempted at least once. Additional attempts are made if the previous attempt failed
with a retryable error. The number of additional attempts is governed by the maxRetries
property provided
on the RetryConfig
argument.
If mode
option is set to Fixed
, then the retries are made on the
given operation for a specified number of times, with a fixed delay in between each retry each time.
If mode
option is set to Exponential
, then the delay between retries is adjusted to increase
exponentially with each attempt using back-off factor of power 2.
function retry<T>(config: RetryConfig<T>): Promise<T>
Parameters
- config
-
RetryConfig<T>
Parameters to configure retry operation
Returns
Promise<T>
Promise.
translate(unknown)
Translates the AMQP error received at the protocol layer or a SystemError into a MessagingError. All other errors are returned unaltered.
function translate(err: unknown): MessagingError | Error
Parameters
- err
-
unknown
The amqp error that was received.
Returns
MessagingError | Error
MessagingError object.