@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. |
| 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. |
| 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. |
| 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. |
Variables
| Amqp |
Describes the operations that can be performed on(or to get) the AmqpAnnotatedMessage. |
| Amqp |
Describes the operations that can be performed on the message header. |
| Amqp |
Describes the operations that can be performed on the amqp message properties. |
| Connection |
Describes the ConnectionConfig module |
| Connection |
|
| Constants | |
| default |
The cancellable async lock instance. |
| logger | The @azure/logger configuration for this package.
This will output logs using the |
| retryable |
Provides a list of retryable AMQP errors. "InternalServerError", "ServerBusyError", "ServiceUnavailableError", "OperationCancelledError", "SenderBusyError", "SenderNotReadyError", "MessagingError", "DetachForcedError", "ConnectionForcedError", "TransferLimitExceededError" |
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<T>.
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<T>.
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.
Variable Details
AmqpAnnotatedMessage
Describes the operations that can be performed on(or to get) the AmqpAnnotatedMessage.
AmqpAnnotatedMessage: { fromRheaMessage(msg: Message) => AmqpAnnotatedMessage, toRheaMessage(msg: AmqpAnnotatedMessage) => Message }
Type
{ fromRheaMessage(msg: Message) => AmqpAnnotatedMessage, toRheaMessage(msg: AmqpAnnotatedMessage) => Message }
AmqpMessageHeader
Describes the operations that can be performed on the message header.
AmqpMessageHeader: { fromRheaMessageHeader(props: MessageHeader) => AmqpMessageHeader, toRheaMessageHeader(props: AmqpMessageHeader) => MessageHeader }
Type
{ fromRheaMessageHeader(props: MessageHeader) => AmqpMessageHeader, toRheaMessageHeader(props: AmqpMessageHeader) => MessageHeader }
AmqpMessageProperties
Describes the operations that can be performed on the amqp message properties.
AmqpMessageProperties: { fromRheaMessageProperties(props: MessageProperties) => AmqpMessageProperties, toRheaMessageProperties(props: AmqpMessageProperties) => MessageProperties }
Type
{ fromRheaMessageProperties(props: MessageProperties) => AmqpMessageProperties, toRheaMessageProperties(props: AmqpMessageProperties) => MessageProperties }
ConnectionConfig
Describes the ConnectionConfig module
ConnectionConfig: { create(connectionString: string, path?: string) => ConnectionConfig, validate(config: ConnectionConfig, options?: ConnectionConfigOptions) => void }
Type
{ create(connectionString: string, path?: string) => ConnectionConfig, validate(config: ConnectionConfig, options?: ConnectionConfigOptions) => void }
ConnectionContextBase
ConnectionContextBase: { create(parameters: CreateConnectionContextBaseParameters) => ConnectionContextBase }
Type
{ create(parameters: CreateConnectionContextBaseParameters) => ConnectionContextBase }
Constants
Constants: { TCP: "tcp", TLS: "tls", aadEventHubsAudience: "https://eventhubs.azure.net/", aadEventHubsScope: "https://eventhubs.azure.net//.default", aadServiceBusAudience: "https://servicebus.azure.net/", aadServiceBusScope: "https://servicebus.azure.net//.default", aadTokenValidityMarginInMs: 5000, associatedLinkName: "associated-link-name", attachEpoch: "com.microsoft:epoch", cbsEndpoint: "$cbs", cbsReplyTo: "cbs", connectionError: "connection_error", connectionReconnectDelay: 300, dateTimeOffset: "com.microsoft:datetime-offset", deadLetterDescription: "deadletter-description", deadLetterName: "com.microsoft:dead-letter", deadLetterReason: "deadletter-reason", deadLetterSource: "x-opt-deadletter-source", defaultConnectionIdleTimeoutInMs: 60000, defaultConsumerGroup: "$default", defaultDelayBetweenOperationRetriesInMs: 30000, defaultMaxDelayForExponentialRetryInMs: 90000, defaultMaxRetries: 3, defaultMaxRetriesForConnection: 150, defaultOperationTimeoutInMs: 60000, defaultPrefetchCount: 1000, descriptorCodes: { correlationFilterList: 83483426825, falseFilterList: 83483426824, ruleDescriptionList: 1335734829060, sqlFilterList: 83483426822, sqlRuleActionList: 1335734829062, trueFilterList: 83483426823 }, dispositionStatus: "disposition-status", enableReceiverRuntimeMetricName: "com.microsoft:enable-receiver-runtime-metric", enqueueSequenceNumber: "x-opt-enqueue-sequence-number", enqueuedTime: "x-opt-enqueued-time", enqueuedTimeAnnotation: "amqp.annotation.x-opt-enqueued-time", enqueuedTimeUtc: "enqueued-time-utc", ensureContainerAndBlob: "ensureContainerAndBlob", error: "error", errorCondition: "error-condition", establishConnection: "establishConnection", eventHub: "eventhub", fromSequenceNumber: "from-sequence-number", guidSize: 16, lockTokenMapKey: "lock-token", lockTokens: "lock-tokens", lockedUntil: "x-opt-locked-until", management: "$management", managementRequestKey: "managementRequest", maxAbsoluteExpiryTime: number, maxDeadLetterReasonLength: 4096, maxDurationValue: 922337203685477, maxMessageIdLength: 128, maxPartitionKeyLength: 128, maxSessionIdLength: 128, maxUint32Value: 4294967295, maxUserAgentLength: 512, maximumSqlFilterStatementLength: 1024, maximumSqlRuleActionStatementLength: 1024, message: "message", messageCount: "message-count", messageIdMapKey: "message-id", messageState: "x-opt-message-state", minDurationValue: -922337203685477, negotiateCbsKey: "negotiateCbs", negotiateClaim: "negotiateClaim", offset: "x-opt-offset", offsetAnnotation: "amqp.annotation.x-opt-offset", operationPutToken: "put-token", operations: { addRule: "com.microsoft:add-rule", cancelScheduledMessage: "com.microsoft:cancel-scheduled-message", deleteMessages: "com.microsoft:batch-delete-messages", enumerateRules: "com.microsoft:enumerate-rules", enumerateSessions: "com.microsoft:get-message-sessions", getSessionState: "com.microsoft:get-session-state", peekMessage: "com.microsoft:peek-message", putToken: "put-token", read: "READ", receiveBySequenceNumber: "com.microsoft:receive-by-sequence-number", removeRule: "com.microsoft:remove-rule", renewLock: "com.microsoft:renew-lock", renewSessionLock: "com.microsoft:renew-session-lock", scheduleMessage: "com.microsoft:schedule-message", setSessionState: "com.microsoft:set-session-state", updateDisposition: "com.microsoft:update-disposition" }, partition: "partition", partitionId: "partitionId", partitionIdName: "x-opt-partition-id", partitionKey: "x-opt-partition-key", pathDelimiter: "/", propertiesToModify: "properties-to-modify", publisher: "x-opt-publisher-name", readOperation: "READ", receiverError: "receiver_error", receiverIdentifierName: "com.microsoft:receiver-name", receiverSettleMode: "receiver-settle-mode", reconnectLimit: 100, ruleNameMaximumLength: 50, scheduledEnqueueTime: "x-opt-scheduled-enqueue-time", senderError: "sender_error", sequenceNumber: "x-opt-sequence-number", sequenceNumberAnnotation: "amqp.annotation.x-opt-sequence-number", sequenceNumberMapKey: "sequence-number", sequenceNumbers: "sequence-numbers", serverTimeout: "com.microsoft:server-timeout", sessionError: "session_error", sessionFilterName: "com.microsoft:session-filter", sessionIdMapKey: "session-id", statusCode: "status-code", statusDescription: "status-description", timespan: "com.microsoft:timespan", trackingId: "com.microsoft:tracking-id", uri: "com.microsoft:uri", vendorString: "com.microsoft", viaPartitionKey: "x-opt-via-partition-key" }
Type
{ TCP: "tcp", TLS: "tls", aadEventHubsAudience: "https://eventhubs.azure.net/", aadEventHubsScope: "https://eventhubs.azure.net//.default", aadServiceBusAudience: "https://servicebus.azure.net/", aadServiceBusScope: "https://servicebus.azure.net//.default", aadTokenValidityMarginInMs: 5000, associatedLinkName: "associated-link-name", attachEpoch: "com.microsoft:epoch", cbsEndpoint: "$cbs", cbsReplyTo: "cbs", connectionError: "connection_error", connectionReconnectDelay: 300, dateTimeOffset: "com.microsoft:datetime-offset", deadLetterDescription: "deadletter-description", deadLetterName: "com.microsoft:dead-letter", deadLetterReason: "deadletter-reason", deadLetterSource: "x-opt-deadletter-source", defaultConnectionIdleTimeoutInMs: 60000, defaultConsumerGroup: "$default", defaultDelayBetweenOperationRetriesInMs: 30000, defaultMaxDelayForExponentialRetryInMs: 90000, defaultMaxRetries: 3, defaultMaxRetriesForConnection: 150, defaultOperationTimeoutInMs: 60000, defaultPrefetchCount: 1000, descriptorCodes: { correlationFilterList: 83483426825, falseFilterList: 83483426824, ruleDescriptionList: 1335734829060, sqlFilterList: 83483426822, sqlRuleActionList: 1335734829062, trueFilterList: 83483426823 }, dispositionStatus: "disposition-status", enableReceiverRuntimeMetricName: "com.microsoft:enable-receiver-runtime-metric", enqueueSequenceNumber: "x-opt-enqueue-sequence-number", enqueuedTime: "x-opt-enqueued-time", enqueuedTimeAnnotation: "amqp.annotation.x-opt-enqueued-time", enqueuedTimeUtc: "enqueued-time-utc", ensureContainerAndBlob: "ensureContainerAndBlob", error: "error", errorCondition: "error-condition", establishConnection: "establishConnection", eventHub: "eventhub", fromSequenceNumber: "from-sequence-number", guidSize: 16, lockTokenMapKey: "lock-token", lockTokens: "lock-tokens", lockedUntil: "x-opt-locked-until", management: "$management", managementRequestKey: "managementRequest", maxAbsoluteExpiryTime: number, maxDeadLetterReasonLength: 4096, maxDurationValue: 922337203685477, maxMessageIdLength: 128, maxPartitionKeyLength: 128, maxSessionIdLength: 128, maxUint32Value: 4294967295, maxUserAgentLength: 512, maximumSqlFilterStatementLength: 1024, maximumSqlRuleActionStatementLength: 1024, message: "message", messageCount: "message-count", messageIdMapKey: "message-id", messageState: "x-opt-message-state", minDurationValue: -922337203685477, negotiateCbsKey: "negotiateCbs", negotiateClaim: "negotiateClaim", offset: "x-opt-offset", offsetAnnotation: "amqp.annotation.x-opt-offset", operationPutToken: "put-token", operations: { addRule: "com.microsoft:add-rule", cancelScheduledMessage: "com.microsoft:cancel-scheduled-message", deleteMessages: "com.microsoft:batch-delete-messages", enumerateRules: "com.microsoft:enumerate-rules", enumerateSessions: "com.microsoft:get-message-sessions", getSessionState: "com.microsoft:get-session-state", peekMessage: "com.microsoft:peek-message", putToken: "put-token", read: "READ", receiveBySequenceNumber: "com.microsoft:receive-by-sequence-number", removeRule: "com.microsoft:remove-rule", renewLock: "com.microsoft:renew-lock", renewSessionLock: "com.microsoft:renew-session-lock", scheduleMessage: "com.microsoft:schedule-message", setSessionState: "com.microsoft:set-session-state", updateDisposition: "com.microsoft:update-disposition" }, partition: "partition", partitionId: "partitionId", partitionIdName: "x-opt-partition-id", partitionKey: "x-opt-partition-key", pathDelimiter: "/", propertiesToModify: "properties-to-modify", publisher: "x-opt-publisher-name", readOperation: "READ", receiverError: "receiver_error", receiverIdentifierName: "com.microsoft:receiver-name", receiverSettleMode: "receiver-settle-mode", reconnectLimit: 100, ruleNameMaximumLength: 50, scheduledEnqueueTime: "x-opt-scheduled-enqueue-time", senderError: "sender_error", sequenceNumber: "x-opt-sequence-number", sequenceNumberAnnotation: "amqp.annotation.x-opt-sequence-number", sequenceNumberMapKey: "sequence-number", sequenceNumbers: "sequence-numbers", serverTimeout: "com.microsoft:server-timeout", sessionError: "session_error", sessionFilterName: "com.microsoft:session-filter", sessionIdMapKey: "session-id", statusCode: "status-code", statusDescription: "status-description", timespan: "com.microsoft:timespan", trackingId: "com.microsoft:tracking-id", uri: "com.microsoft:uri", vendorString: "com.microsoft", viaPartitionKey: "x-opt-via-partition-key" }
defaultCancellableLock
The cancellable async lock instance.
defaultCancellableLock: CancellableAsyncLock
Type
logger
The @azure/logger configuration for this package.
This will output logs using the azure:event-hubs namespace prefix.
logger: AzureLogger
Type
retryableErrors
Provides a list of retryable AMQP errors. "InternalServerError", "ServerBusyError", "ServiceUnavailableError", "OperationCancelledError", "SenderBusyError", "SenderNotReadyError", "MessagingError", "DetachForcedError", "ConnectionForcedError", "TransferLimitExceededError"
retryableErrors: string[]
Type
string[]