@azure/service-bus
Version:
Azure Service Bus SDK for JavaScript
1,149 lines (1,115 loc) • 157 kB
TypeScript
/// <reference types="node" />
import { AbortSignalLike } from '@azure/abort-controller';
import { AmqpAnnotatedMessage } from '@azure/core-amqp';
import { Buffer as Buffer_2 } from 'buffer';
import { CommonClientOptions } from '@azure/core-client';
import { delay } from '@azure/core-amqp';
import { Delivery } from 'rhea-promise';
import { HttpMethods } from '@azure/core-rest-pipeline';
import Long from 'long';
import { MessagingError } from '@azure/core-amqp';
import { NamedKeyCredential } from '@azure/core-auth';
import { OperationOptions } from '@azure/core-client';
import { OperationTracingOptions } from '@azure/core-tracing';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
import { PageSettings } from '@azure/core-paging';
import { ProxySettings } from '@azure/core-rest-pipeline';
import { RetryMode } from '@azure/core-amqp';
import { RetryOptions } from '@azure/core-amqp';
import { SASCredential } from '@azure/core-auth';
import { ServiceClient } from '@azure/core-client';
import { TokenCredential } from '@azure/core-auth';
import { TokenType } from '@azure/core-amqp';
import { TracingContext } from '@azure/core-tracing';
import { UserAgentPolicyOptions } from '@azure/core-rest-pipeline';
import { WebSocketImpl } from 'rhea-promise';
import { WebSocketOptions } from '@azure/core-amqp';
/**
* Represents type of `AuthorizationRule` in ATOM based management operations.
*/
export declare interface AuthorizationRule {
/**
* The claim type.
*/
claimType: string;
/**
* The list of rights("Manage" | "Send" | "Listen").
*/
accessRights?: ("Manage" | "Send" | "Listen")[];
/**
* The authorization rule key name.
*/
keyName: string;
/**
* The primary key for the authorization rule.
*/
primaryKey?: string;
/**
* The secondary key for the authorization rule.
*/
secondaryKey?: string;
}
/**
* Represents the correlation filter expression.
* A CorrelationRuleFilter holds a set of conditions that are matched against user and system properties
* of incoming messages from a Subscription.
*/
export declare interface CorrelationRuleFilter {
/**
* Value to be matched with the `correlationId` property of the incoming message.
*/
correlationId?: string;
/**
* Value to be matched with the `messageId` property of the incoming message.
*/
messageId?: string;
/**
* Value to be matched with the `to` property of the incoming message.
*/
to?: string;
/**
* Value to be matched with the `replyTo` property of the incoming message.
*/
replyTo?: string;
/**
* Value to be matched with the `subject` property of the incoming message.
*/
subject?: string;
/**
* Value to be matched with the `sessionId` property of the incoming message.
*/
sessionId?: string;
/**
* Value to be matched with the `replyToSessionId` property of the incoming message.
*/
replyToSessionId?: string;
/**
* Value to be matched with the `contentType` property of the incoming message.
*/
contentType?: string;
/**
* Value to be matched with the user properties of the incoming message.
*/
applicationProperties?: {
[key: string]: string | number | boolean | Date;
};
}
/**
* Options to configure the `createBatch` method on the `Sender`.
* - `maxSizeInBytes`: The upper limit for the size of batch.
*
* Example usage:
* ```js
* {
* maxSizeInBytes: 1024 * 1024 // 1 MB
* }
* ```
*/
export declare interface CreateMessageBatchOptions extends OperationOptionsBase {
/**
* The upper limit for the size of batch. The `tryAdd` function will return `false` after this limit is reached.
*/
maxSizeInBytes?: number;
}
/**
* Represents settable options on a queue
*/
export declare interface CreateQueueOptions extends OperationOptions {
/**
* Determines the amount of time in seconds in which a message should be locked for
* processing by a receiver. After this period, the message is unlocked and available
* for consumption by the next receiver.
* (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)
*
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
lockDuration?: string;
/**
* Specifies the maximum queue size in megabytes. Any attempt to enqueue a message that
* will cause the queue to exceed this value will fail.
*/
maxSizeInMegabytes?: number;
/**
* The maximum message size in kilobytes for messages sent to this queue.
*
* (Configurable only for Premium Tier Service Bus namespace.)
*/
maxMessageSizeInKilobytes?: number;
/**
* If enabled, the topic will detect duplicate messages within the time
* span specified by the DuplicateDetectionHistoryTimeWindow property.
* Settable only at queue creation time.
*/
requiresDuplicateDetection?: boolean;
/**
* If set to true, the queue will be session-aware and only SessionReceiver
* will be supported. Session-aware queues are not supported through REST.
* Settable only at queue creation time.
*/
requiresSession?: boolean;
/**
* Depending on whether DeadLettering is enabled, a message is automatically
* moved to the dead-letter sub-queue or deleted if it has been stored in the
* queue for longer than the specified time.
* This value is overwritten by a TTL specified on the message
* if and only if the message TTL is smaller than the TTL set on the queue.
* This value is immutable after the Queue has been created.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
defaultMessageTimeToLive?: string;
/**
* If it is enabled and a message expires, the Service Bus moves the message
* from the queue into the queue’s dead-letter sub-queue. If disabled,
* message will be permanently deleted from the queue.
* Settable only at queue creation time.
*/
deadLetteringOnMessageExpiration?: boolean;
/**
* Specifies the time span during which the Service Bus detects message duplication.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
duplicateDetectionHistoryTimeWindow?: string;
/**
* The maximum delivery count of messages after which if it is still not settled,
* gets moved to the dead-letter sub-queue.
*/
maxDeliveryCount?: number;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations?: boolean;
/**
* Authorization rules on the queue
*/
authorizationRules?: AuthorizationRule[];
/**
* Status of the messaging entity.
*/
status?: EntityStatus;
/**
* Absolute URL or the name of the queue or topic the
* messages are to be forwarded to.
* For example, an absolute URL input would be of the form
* `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`
*/
forwardTo?: string;
/**
* The user provided metadata information associated with the queue.
* Used to specify textual content such as tags, labels, etc.
* Value must not exceed 1024 bytes encoded in utf-8.
*/
userMetadata?: string;
/**
* Max idle time before entity is deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
autoDeleteOnIdle?: string;
/**
* Specifies whether the queue should be partitioned.
*/
enablePartitioning?: boolean;
/**
* Absolute URL or the name of the queue or topic the dead-lettered
* messages are to be forwarded to.
* For example, an absolute URL input would be of the form
* `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`
*/
forwardDeadLetteredMessagesTo?: string;
/**
* Specifies whether express entities are enabled on queue.
*/
enableExpress?: boolean;
/**
* Availability status of the messaging entity.
*/
availabilityStatus?: EntityAvailabilityStatus;
}
/**
* Represents settable options on a subscription
*/
export declare interface CreateSubscriptionOptions extends OperationOptions {
/**
* The default lock duration is applied to subscriptions that do not define a lock
* duration.
* (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)
*
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
lockDuration?: string;
/**
* If set to true, the subscription will be session-aware and only SessionReceiver
* will be supported. Session-aware subscription are not supported through REST.
* Settable only at subscription creation time.
*/
requiresSession?: boolean;
/**
* Determines how long a message lives in the subscription. Based on whether
* dead-lettering is enabled, a message whose TTL has expired will either be moved
* to the subscription’s associated DeadLtterQueue or permanently deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
defaultMessageTimeToLive?: string;
/**
* If it is enabled and a message expires, the Service Bus moves the message from
* the queue into the subscription’s dead-letter sub-queue. If disabled, message
* will be permanently deleted from the subscription’s main queue.
* Settable only at subscription creation time.
*/
deadLetteringOnMessageExpiration?: boolean;
/**
* Determines how the Service Bus handles a message that causes an exception during
* a subscription’s filter evaluation. If the value is set to true, the message that
* caused the exception will be moved to the subscription’s dead-letter sub-queue.
* Otherwise, it will be discarded. By default this parameter is set to true,
* allowing the user a chance to investigate the cause of the exception.
* It can occur from a malformed message or some incorrect assumptions being made
* in the filter about the form of the message. Settable only at topic creation time.
*/
deadLetteringOnFilterEvaluationExceptions?: boolean;
/**
* Represents the options to create the default rule for the subscription.
*/
defaultRuleOptions?: {
/**
* Name of the rule
*/
name: string;
/**
* Defines the filter expression that the rule evaluates. For `SqlRuleFilter` input,
* the expression string is interpreted as a SQL92 expression which must
* evaluate to True or False. Only one between a `CorrelationRuleFilter` or
* a `SqlRuleFilter` can be defined.
*/
filter?: SqlRuleFilter | CorrelationRuleFilter;
/**
* The SQL like expression that can be executed on the message should the
* associated filter apply.
*/
action?: SqlRuleAction;
};
/**
* The maximum delivery count of messages after which if it is still not settled,
* gets moved to the dead-letter sub-queue.
*
*/
maxDeliveryCount?: number;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations?: boolean;
/**
* Status of the messaging entity.
*/
status?: EntityStatus;
/**
* Absolute URL or the name of the queue or topic the
* messages are to be forwarded to.
* For example, an absolute URL input would be of the form
* `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`
*/
forwardTo?: string;
/**
* The user provided metadata information associated with the subscription.
* Used to specify textual content such as tags, labels, etc.
* Value must not exceed 1024 bytes encoded in utf-8.
*/
userMetadata?: string;
/**
* Absolute URL or the name of the queue or topic the dead-lettered
* messages are to be forwarded to.
* For example, an absolute URL input would be of the form
* `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`
*/
forwardDeadLetteredMessagesTo?: string;
/**
* Max idle time before entity is deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
autoDeleteOnIdle?: string;
/**
* Availability status of the messaging entity.
*/
availabilityStatus?: EntityAvailabilityStatus;
}
/**
* Represents settable options on a topic
*/
export declare interface CreateTopicOptions extends OperationOptions {
/**
* Determines how long a message lives in the associated subscriptions.
* Subscriptions inherit the TTL from the topic unless they are created explicitly
* with a smaller TTL. Based on whether dead-lettering is enabled, a message whose
* TTL has expired will either be moved to the subscription’s associated dead-letter
* sub-queue or will be permanently deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
defaultMessageTimeToLive?: string;
/**
* Specifies the maximum topic size in megabytes. Any attempt to enqueue a message
* that will cause the topic to exceed this value will fail. All messages that are
* stored in the topic or any of its subscriptions count towards this value.
* Multiple copies of a message that reside in one or multiple subscriptions count
* as a single messages. For example, if message m exists once in subscription s1
* and twice in subscription s2, m is counted as a single message.
*/
maxSizeInMegabytes?: number;
/**
* The maximum message size in kilobytes for messages sent to this topic.
*
* (Configurable only for Premium Tier Service Bus namespace.)
*/
maxMessageSizeInKilobytes?: number;
/**
* If enabled, the topic will detect duplicate messages within the time span
* specified by the DuplicateDetectionHistoryTimeWindow property.
* Settable only at topic creation time.
*/
requiresDuplicateDetection?: boolean;
/**
* Specifies the time span during which the Service Bus will detect message duplication.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
duplicateDetectionHistoryTimeWindow?: string;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations?: boolean;
/**
* Authorization rules on the topic
*/
authorizationRules?: AuthorizationRule[];
/**
* Status of the messaging entity.
*/
status?: EntityStatus;
/**
* The user provided metadata information associated with the topic.
* Used to specify textual content such as tags, labels, etc.
* Value must not exceed 1024 bytes encoded in utf-8.
*/
userMetadata?: string;
/**
* Specifies whether the topic supports message ordering.
*/
supportOrdering?: boolean;
/**
* Max idle time before entity is deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
autoDeleteOnIdle?: string;
/**
* Specifies whether the topic should be partitioned
*/
enablePartitioning?: boolean;
/**
* Specifies whether express entities are enabled on topic.
*/
enableExpress?: boolean;
/**
* Availability status of the messaging entity.
*/
availabilityStatus?: EntityAvailabilityStatus;
}
/**
* Describes the reason and error description for dead lettering a message using the `deadLetter()`
* method on the message received from Service Bus.
*/
export declare interface DeadLetterOptions {
/**
* The reason for deadlettering the message.
*/
deadLetterReason: string;
/**
* The error description for deadlettering the message.
*/
deadLetterErrorDescription: string;
}
export { delay }
export { Delivery }
/**
* Represents the result of list operation on entities which also contains the `continuationToken` to start iterating over from.
*/
export declare type EntitiesResponse<T extends object> = WithResponse<Array<T>> & Pick<PageSettings, "continuationToken">;
/**
* Possible values for `availabilityStatus` of the Service Bus messaging entities.
*/
export declare type EntityAvailabilityStatus = "Available" | "Limited" | "Renaming" | "Restoring" | "Unknown";
/**
* Possible values for `status` of the Service Bus messaging entities.
*/
export declare type EntityStatus = "Active" | "Creating" | "Deleting" | "ReceiveDisabled" | "SendDisabled" | "Disabled" | "Renaming" | "Restoring" | "Unknown";
/**
* Options when getting an iterable iterator from Service Bus.
*/
export declare interface GetMessageIteratorOptions extends OperationOptionsBase {
}
/**
* An individual header within a HttpHeaders collection.
*/
export declare interface HttpHeader {
/**
* The name of the header.
*/
name: string;
/**
* The value of the header.
*/
value: string;
}
/**
* A collection of HTTP header key/value pairs.
*/
export declare interface HttpHeadersLike {
/**
* Set a header in this collection with the provided name and value. The name is
* case-insensitive.
* @param headerName - The name of the header to set. This value is case-insensitive.
* @param headerValue - The value of the header to set.
*/
set(headerName: string, headerValue: string | number): void;
/**
* Get the header value for the provided header name, or undefined if no header exists in this
* collection with the provided name.
* @param headerName - The name of the header.
*/
get(headerName: string): string | undefined;
/**
* Get whether or not this header collection contains a header entry for the provided header name.
*/
contains(headerName: string): boolean;
/**
* Remove the header with the provided headerName. Return whether or not the header existed and
* was removed.
* @param headerName - The name of the header to remove.
*/
remove(headerName: string): boolean;
/**
* Get the headers that are contained this collection as an object.
*/
rawHeaders(): RawHttpHeaders;
/**
* Get the headers that are contained in this collection as an array.
*/
headersArray(): HttpHeader[];
/**
* Get the header names that are contained in this collection.
*/
headerNames(): string[];
/**
* Get the header values that are contained in this collection.
*/
headerValues(): string[];
/**
* Create a deep clone/copy of this HttpHeaders collection.
*/
clone(): HttpHeadersLike;
/**
* Get the JSON object representation of this HTTP header collection.
* The result is the same as `rawHeaders()`.
*/
toJson(options?: {
preserveCase?: boolean;
}): RawHttpHeaders;
}
/**
* The properties on an HTTP response which will always be present.
*/
export declare interface HttpResponse {
/**
* The raw request
*/
request: WebResourceLike;
/**
* The HTTP response status (e.g. 200)
*/
status: number;
/**
* The HTTP response headers.
*/
headers: HttpHeadersLike;
}
/**
* Determines if an error is of type `ServiceBusError`
*
* @param err - An error to check to see if it's of type ServiceBusError
*/
export declare function isServiceBusError(err: unknown): err is ServiceBusError;
/**
* The general message handler interface (used for streamMessages).
*/
export declare interface MessageHandlers {
/**
* Handler that processes messages from service bus.
*
* @param message - A message received from Service Bus.
*/
processMessage(message: ServiceBusReceivedMessage): Promise<void>;
/**
* Handler that processes errors that occur during receiving.
*
* This handler will be called for any error that occurs in the receiver when
* - receiving the message, or
* - executing your `processMessage` callback, or
* - receiver is completing the message on your behalf after successfully running your `processMessage` callback and `autoCompleteMessages` is enabled
* - receiver is abandoning the message on your behalf if running your `processMessage` callback fails and `autoCompleteMessages` is enabled
* - receiver is renewing the lock on your behalf due to auto lock renewal feature being enabled
*
* Note that when receiving messages in a stream using `subscribe()`, the receiver will automatically retry receiving messages on all errors unless
* `close()` is called on the subscription. It is completely up to users to decide what errors are considered non-recoverable and to handle them
* accordingly in this callback.
* For a list of errors occurs within Service Bus, please refer to https://docs.microsoft.com/javascript/api/\@azure/service-bus/servicebuserror?view=azure-node-latest
* @param args - The error and additional context to indicate where
* the error originated.
*/
processError(args: ProcessErrorArgs): Promise<void>;
}
export { MessagingError }
/**
* Represents the metadata related to a service bus namespace.
*
*/
export declare interface NamespaceProperties {
/**
* The time at which the namespace was created.
*/
createdAt: Date;
/**
* The SKU/tier of the namespace.
* "Basic", "Standard" and "Premium"
*/
messagingSku: "Basic" | "Premium" | "Standard";
/**
* The last time at which the namespace was modified.
*/
modifiedAt: Date;
/**
* Name of the namespace.
*/
name: string;
/**
* Number of messaging units allocated for namespace.
* Valid only for Premium namespaces.
* messagingUnits would be set to `undefined` for Basic and Standard namespaces.
*/
messagingUnits: number | undefined;
}
export { OperationOptions }
/**
* NOTE: This type is intended to mirror the relevant fields and structure from `@azure/core-client` OperationOptions
*
* Options for configuring tracing and the abortSignal.
*/
export declare type OperationOptionsBase = Pick<OperationOptions, "abortSignal" | "tracingOptions">;
/**
* Parses given connection string into the different properties applicable to Azure Service Bus.
* The properties are useful to then construct a ServiceBusClient.
* @param connectionString - The connection string associated with the Shared Access Policy created
* for the Service Bus namespace, queue or topic.
*/
export declare function parseServiceBusConnectionString(connectionString: string): ServiceBusConnectionStringProperties;
/**
* Describes the options passed to the `peekMessages` method on a receiver.
*/
export declare interface PeekMessagesOptions extends OperationOptionsBase {
/**
* The sequence number to start peeking messages from (inclusive).
*/
fromSequenceNumber?: Long;
/* Excluded from this release type: omitMessageBody */
}
/**
* Arguments to the `processError` callback.
*/
export declare interface ProcessErrorArgs {
/**
* The error.
*/
error: Error | ServiceBusError;
/**
* The operation where the error originated.
*
* 'abandon': Errors that occur when if `abandon` is triggered automatically.
* 'complete': Errors that occur when autoComplete completes a message.
* 'processMessageCallback': Errors thrown from the user's `processMessage` callback passed to `subscribe`.
* 'receive': Errors thrown when receiving messages.
* 'renewLock': Errors thrown when automatic lock renewal fails.
*/
errorSource: "abandon" | "complete" | "processMessageCallback" | "receive" | "renewLock";
/**
* The entity path for the current receiver.
*/
entityPath: string;
/**
* The fully qualified namespace for the Service Bus.
*/
fullyQualifiedNamespace: string;
/**
* The identifier of the client that raised this event.
*/
identifier: string;
}
/**
* Represents the input for updateQueue.
*
*/
export declare interface QueueProperties {
/**
* Name of the queue
*/
readonly name: string;
/**
* Determines the amount of time in seconds in which a message should be locked for
* processing by a receiver. After this period, the message is unlocked and available
* for consumption by the next receiver.
* (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)
*
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
lockDuration: string;
/**
* Specifies the maximum queue size in megabytes. Any attempt to enqueue a message that
* will cause the queue to exceed this value will fail.
*/
maxSizeInMegabytes: number;
/**
* The maximum message size in kilobytes for messages sent to this queue.
*
* Not applicable if service version "2017-04" is chosen when creating the `ServiceBusAdministrationClient`.
*/
maxMessageSizeInKilobytes?: number;
/**
* If enabled, the topic will detect duplicate messages within the time
* span specified by the DuplicateDetectionHistoryTimeWindow property.
* Settable only at queue creation time.
*/
readonly requiresDuplicateDetection: boolean;
/**
* If set to true, the queue will be session-aware and only SessionReceiver
* will be supported. Session-aware queues are not supported through REST.
* Settable only at queue creation time.
*/
readonly requiresSession: boolean;
/**
* Depending on whether DeadLettering is enabled, a message is automatically
* moved to the dead-letter sub-queue or deleted if it has been stored in the
* queue for longer than the specified time.
* This value is overwritten by a TTL specified on the message
* if and only if the message TTL is smaller than the TTL set on the queue.
* This value is immutable after the Queue has been created.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
defaultMessageTimeToLive: string;
/**
* If it is enabled and a message expires, the Service Bus moves the message
* from the queue into the queue’s dead-letter sub-queue. If disabled,
* message will be permanently deleted from the queue.
* Settable only at queue creation time.
*/
deadLetteringOnMessageExpiration: boolean;
/**
* Specifies the time span during which the Service Bus detects message duplication.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
duplicateDetectionHistoryTimeWindow: string;
/**
* The maximum delivery count of messages after which if it is still not settled,
* gets moved to the dead-letter sub-queue.
*/
maxDeliveryCount: number;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations: boolean;
/**
* Authorization rules on the queue
*/
authorizationRules?: AuthorizationRule[];
/**
* Status of the messaging entity.
*/
status: EntityStatus;
/**
* Absolute URL or the name of the queue or topic the
* messages are to be forwarded to.
* For example, an absolute URL input would be of the form
* `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`
*/
forwardTo?: string;
/**
* The user provided metadata information associated with the queue.
* Used to specify textual content such as tags, labels, etc.
* Value must not exceed 1024 bytes encoded in utf-8.
*/
userMetadata: string;
/**
* Max idle time before entity is deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*
* More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations
*/
autoDeleteOnIdle: string;
/**
* Specifies whether the queue should be partitioned.
*/
readonly enablePartitioning: boolean;
/**
* Absolute URL or the name of the queue or topic the dead-lettered
* messages are to be forwarded to.
* For example, an absolute URL input would be of the form
* `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`
*/
forwardDeadLetteredMessagesTo?: string;
/**
* Specifies whether express entities are enabled on queue.
*/
readonly enableExpress: boolean;
/**
* Availability status of the messaging entity.
*/
readonly availabilityStatus: EntityAvailabilityStatus;
}
/**
* Represents runtime info attributes of a queue entity
*/
export declare interface QueueRuntimeProperties {
/**
* Name of the queue
*/
name: string;
/**
* Created at timestamp
*/
createdAt: Date;
/**
* Updated at timestamp
*/
modifiedAt: Date;
/**
* Accessed at timestamp
*/
accessedAt: Date;
/**
* The entity's message count.
*
*/
totalMessageCount?: number;
/**
* The number of active messages in the queue.
*/
activeMessageCount: number;
/**
* The number of messages that have been dead lettered.
*/
deadLetterMessageCount: number;
/**
* The number of scheduled messages.
*/
scheduledMessageCount: number;
/**
* The number of messages transferred to another queue, topic, or subscription
*/
transferMessageCount: number;
/**
* The number of messages transferred to the dead letter queue.
*/
transferDeadLetterMessageCount: number;
/**
* The entity's size in bytes.
*
*/
sizeInBytes?: number;
}
/**
* A HttpHeaders collection represented as a simple JSON object.
*/
export declare type RawHttpHeaders = {
[headerName: string]: string;
};
/**
* Options when receiving a batch of messages from Service Bus.
*/
export declare interface ReceiveMessagesOptions extends OperationOptionsBase {
/**
* The maximum amount of time to wait for messages to arrive.
* **Default**: `60000` milliseconds.
*/
maxWaitTimeInMs?: number;
}
export { RetryMode }
export { RetryOptions }
/**
* Represents all the attributes of a rule.
*/
export declare interface RuleProperties {
/**
* Name of the rule
*/
readonly name: string;
/**
* Defines the filter expression that the rule evaluates. For `SqlRuleFilter` input,
* the expression string is interpreted as a SQL92 expression which must
* evaluate to True or False. Only one between a `CorrelationRuleFilter` or
* a `SqlRuleFilter` can be defined.
*/
filter: SqlRuleFilter | CorrelationRuleFilter;
/**
* The SQL like expression that can be executed on the message should the
* associated filter apply.
*/
action: SqlRuleAction;
}
/**
* All operations return promises that resolve to an object that has the relevant output.
* These objects also have a property called `_response` that you can use if you want to
* access the direct response from the service.
*/
export declare class ServiceBusAdministrationClient extends ServiceClient {
/**
* Reference to the endpoint as extracted from input connection string.
*/
private endpoint;
/**
* Reference to the endpoint with protocol prefix as extracted from input connection string.
*/
private endpointWithProtocol;
private serviceVersion;
/**
* Singleton instances of serializers used across the various operations.
*/
private namespaceResourceSerializer;
private queueResourceSerializer;
private topicResourceSerializer;
private subscriptionResourceSerializer;
private ruleResourceSerializer;
/**
* Credentials used to generate tokens as required for the various operations.
*/
private credentials;
/**
* Initializes a new instance of the ServiceBusAdministrationClient class.
* @param connectionString - The connection string needed for the client to connect to Azure.
* @param options - PipelineOptions
*/
constructor(connectionString: string, options?: ServiceBusAdministrationClientOptions);
/**
*
* @param fullyQualifiedNamespace - The fully qualified namespace of your Service Bus instance which is
* likely to be similar to <yournamespace>.servicebus.windows.net.
* @param credential - A credential object used by the client to get the token to authenticate the connection
* with the Azure Service Bus. See @azure/identity for creating the credentials.
* If you're using your own implementation of the `TokenCredential` interface against AAD, then set the "scopes" for service-bus
* to be `["https://servicebus.azure.net//user_impersonation"]` to get the appropriate token.
* Use the `AzureNamedKeyCredential` from @azure/core-auth if you want to pass in a `SharedAccessKeyName`
* and `SharedAccessKey` without using a connection string. These fields map to the `name` and `key` field respectively
* in `AzureNamedKeyCredential`.
* @param options - PipelineOptions
*/
constructor(fullyQualifiedNamespace: string, credential: TokenCredential | NamedKeyCredential, options?: ServiceBusAdministrationClientOptions);
/**
* Returns an object representing the metadata related to a service bus namespace.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*
*/
getNamespaceProperties(operationOptions?: OperationOptions): Promise<WithResponse<NamespaceProperties>>;
/**
* Creates a queue with given name, configured using the given options
* @param options - Options to configure the Queue being created(For example, you can configure a queue to support partitions or sessions)
* and the operation options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
createQueue(queueName: string, options?: CreateQueueOptions): Promise<WithResponse<QueueProperties>>;
/**
* Returns an object representing the Queue and its properties.
* If you want to get the Queue runtime info like message count details, use `getQueueRuntimeProperties` API.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
getQueue(queueName: string, operationOptions?: OperationOptions): Promise<WithResponse<QueueProperties>>;
/**
* Returns an object representing the Queue runtime info like message count details.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
getQueueRuntimeProperties(queueName: string, operationOptions?: OperationOptions): Promise<WithResponse<QueueRuntimeProperties>>;
/**
* Returns a list of objects, each representing a Queue along with its properties.
* If you want to get the runtime info of the queues like message count, use `getQueuesRuntimeProperties` API instead.
* @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
private getQueues;
private listQueuesPage;
private listQueuesAll;
/**
* Returns an async iterable iterator to list all the queues.
*
* .byPage() returns an async iterable iterator to list the queues in pages.
*
* @returns An asyncIterableIterator that supports paging.
*/
listQueues(options?: OperationOptions): PagedAsyncIterableIterator<QueueProperties, EntitiesResponse<QueueProperties>>;
/**
* Returns a list of objects, each representing a Queue's runtime info like message count details.
* @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
private getQueuesRuntimeProperties;
private listQueuesRuntimePropertiesPage;
private listQueuesRuntimePropertiesAll;
/**
* Returns an async iterable iterator to list runtime info of the queues.
*
* .byPage() returns an async iterable iterator to list runtime info of the queues in pages.
*
*
* @returns An asyncIterableIterator that supports paging.
*/
listQueuesRuntimeProperties(options?: OperationOptions): PagedAsyncIterableIterator<QueueRuntimeProperties, EntitiesResponse<QueueRuntimeProperties>>;
/**
* Updates the queue based on the queue properties provided.
* All queue properties must be set even though only a subset of them are actually updatable.
* Therefore, the suggested flow is to use the output from `getQueue()`, update the desired properties in it, and then pass the modified object to `updateQueue()`.
*
* The properties that cannot be updated are marked as readonly in the `QueueProperties` interface.
*
* @param queue - Object representing the properties of the queue and the raw response.
* `requiresSession`, `requiresDuplicateDetection`, `enablePartitioning`, and `name` can't be updated after creating the queue.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
updateQueue(queue: WithResponse<QueueProperties>, operationOptions?: OperationOptions): Promise<WithResponse<QueueProperties>>;
/**
* Deletes a queue.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
deleteQueue(queueName: string, operationOptions?: OperationOptions): Promise<WithResponse<{}>>;
/**
* Checks whether a given queue exists or not.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*/
queueExists(queueName: string, operationOptions?: OperationOptions): Promise<boolean>;
/**
* Creates a topic with given name, configured using the given options
* @param options - Options to configure the Topic being created(For example, you can configure a topic to support partitions)
* and the operation options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
createTopic(topicName: string, options?: CreateTopicOptions): Promise<WithResponse<TopicProperties>>;
/**
* Returns an object representing the Topic and its properties.
* If you want to get the Topic runtime info like subscription count details, use `getTopicRuntimeProperties` API.
* @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.
*
* Following are errors that can be expected from this operation
* @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,
* @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,
* @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,
* @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,
* @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as
* bad requests or requests resulting in conflicting operation on the server,
* @throws `RestError` with code and statusCo