///
import { MessageHandlerOptions } from '@azure/service-bus';
import { MessagingError } from '@azure/service-bus';
import { Observable } from 'rxjs';
import { OperatorFunction } from 'rxjs';
import { ProxySettings } from '@azure/core-http';
import { ReceiveMode } from '@azure/service-bus';
import { Sender } from '@azure/service-bus';
import { ServiceBusClient } from '@azure/service-bus';
import { ServiceBusClientOptions } from '@azure/service-bus';
import { ServiceBusMessage } from '@azure/service-bus';
import { SessionReceiverOptions } from '@azure/service-bus';
import { TokenProvider } from '@azure/service-bus';
export declare interface AttribusConfiguration {
/**
* Instances of the classes decorated with service bus entity decorates (@Queue, @Subscriber, @QueueEmitter, @Topic & @SbInterceptor)
*/
containers: Array;
/**
* A list of server configuration objects
*/
servers: SbServerOptions[];
/**
* A list of client configuration objects
*/
clients?: SbClientOptions[];
errorHandler?: SbErrorHandler;
}
export declare abstract class AttribusManagerBase {
private [DiscoveryServiceSymbol];
protected abstract getConfiguration(): Promise;
protected createDiscoveryService(configuration: AttribusConfiguration): Promise;
start(): Promise;
close(): Promise;
}
/**
* @internal
* @ignore
* Represents type of `AuthorizationRule` in ATOM based management operations.
*/
declare type AuthorizationRule = {
claimType: string;
claimValue: string;
rights: {
accessRights?: string[];
};
keyName: string;
primaryKey?: string;
secondaryKey?: string;
};
/**
* Represents the correlation filter expression.
* A CorrelationFilter holds a set of conditions that are matched against user and system properties
* of incoming messages from a Subscription.
*/
declare interface CorrelationFilter {
/**
* 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 `label` property of the incoming message.
*/
label?: 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.
*/
userProperties?: any;
}
export declare interface Ctor extends Function {
new (...args: any[]): T;
}
declare const DiscoveryServiceSymbol: unique symbol;
/**
* @internal
* @ignore
* Possible values for `status` of the Service Bus messaging entities.
*/
declare type EntityStatus = "Active" | "Creating" | "Deleting" | "ReceiveDisabled" | "SendDisabled" | "Disabled" | "Renaming" | "Restoring" | "Unknown";
export declare namespace Extensibility {
const SbSubscriberMetadata: typeof SbSubscriberMetadata;
export type SbSubscriberMetadata = SbSubscriberMetadata;
const SbEmitterMetadata: typeof SbEmitterMetadata;
export type SbEmitterMetadata = SbEmitterMetadata;
const MetadataTarget: typeof MetadataTarget;
export type MetadataTarget = MetadataTarget;
export type SbEmitterTypeMap = SbEmitterTypeMap;
export type SbSubscriberTypeMap = SbSubscriberTypeMap;
const SbDiscoveryService: typeof SbDiscoveryService;
export type SbDiscoveryService = SbDiscoveryService;
}
/**
* @internal
* @ignore
* Represents type of message count details in ATOM based management operations.
*/
declare type MessageCountDetails = {
activeMessageCount: number;
deadLetterMessageCount: number;
scheduledMessageCount: number;
transferMessageCount: number;
transferDeadLetterMessageCount: number;
};
declare class MetadataTarget {
readonly target: Ctor;
private emitters;
private subscribers;
private interceptors;
constructor(target: Ctor);
addTopic(metadataArgs: SbTopicMetadataOptions, key: string | symbol): void;
addQueueEmitter(metadataArgs: SbQueueMetadataOptions, key: string | symbol): void;
addQueue(metadataArgs: SbQueueSubscriptionMetadataOptions, key: string | symbol, descriptor?: PropertyDescriptor): void;
addSubscription(metadataArgs: SbSubscriptionMetadataOptions, key: string | symbol, descriptor?: PropertyDescriptor): void;
addInterceptor(interceptors: Array, key: string | symbol): void;
getEmitter(key: string | symbol): SbEmitterMetadata<"queue" | "topic">;
getEmitters(): IterableIterator<[string | symbol, SbEmitterMetadata<"queue" | "topic">]>;
getSubscription(key: string | symbol): SbSubscriberMetadata<"queue" | "subscription">;
getSubscriptions(): IterableIterator<[string | symbol, SbSubscriberMetadata<"queue" | "subscription">]>;
private addSubscriber;
}
export declare interface NextInterceptor {
/**
* Returns an `Observable` representing the response stream from the route
* handler.
*/
handle(): Observable;
}
export declare type PropOrMethodDecorator = TVar extends TTrue ? MethodDecorator : >, K extends string>(target: T, key: K) => void;
/**
* Subscribes to incoming events from a queue
*/
export declare function Queue(metadata: SbQueueSubscriptionMetadataOptions): PropOrMethodDecorator;
/**
* @internal
* @ignore
* Represents all attributes of a queue entity
*/
declare interface QueueDetails {
/**
* Name of the queue
*/
queueName: 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
* can be consumed by the next receiver.
* Settable only at queue creation time.
* This is specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*/
lockDuration: string;
/**
* The entity's size in bytes.
*
*/
sizeInBytes?: number;
/**
* 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 entity's message count.
*
*/
messageCount?: number;
/**
* Depending on whether DeadLettering is enabled, a message is automatically
* moved to the DeadLetterQueue 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.
*/
defaultMessageTtl: string;
/**
* 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.
*/
duplicateDetectionHistoryTimeWindow: 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:///`
*/
forwardDeadLetteredMessagesTo?: string;
/**
* Max idle time before entity is deleted.
* This is specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*/
autoDeleteOnIdle: 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;
/**
* 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;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations: boolean;
/**
* 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 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;
/**
* 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:///`
*/
forwardTo?: string;
/**
* The user provided metadata information associated with the queue description.
* 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 queue should be partitioned.
*/
enablePartitioning: boolean;
/**
* Authorization rules on the queue
*/
authorizationRules?: AuthorizationRule[];
/**
* Message count details
*/
messageCountDetails?: MessageCountDetails;
/**
* Ordering support for messages
*/
supportOrdering?: boolean;
/**
* Enable express option
*/
enableExpress?: boolean;
/**
* Is anonymous accessible queue option
*/
isAnonymousAccessible?: boolean;
/**
* Entity availability status
*/
entityAvailabilityStatus?: string;
/**
* Status of the messaging entity.
*/
status?: EntityStatus;
/**
* Created at timestamp
*/
createdOn?: string;
/**
* Updated at timestamp
*/
updatedOn?: string;
/**
* Accessed at timestamp
*/
accessedOn?: string;
}
/**
* Subscribes to incoming events from a queue
*/
export declare const QueueEmitter: (metadata: SbQueueMetadataOptions) => PropertyDecorator;
/**
* @internal
* @ignore
* Represents all attributes of a rule entity
*/
declare interface RuleDetails {
/**
* @internal
* @ignore
* Name of the rule
*/
ruleName: string;
/**
* @internal
* @ignore
* Defines the filter expression that the rule evaluates. For `SqlFilter` input,
* the expression string is interpreted as a SQL92 expression which must
* evaluate to True or False. Only one between a `CorrelationFilter` or
* a `SqlFilter` can be defined.
*/
filter?: SqlFilter | CorrelationFilter;
/**
* @internal
* @ignore
* The SQL like expression that can be executed on the message should the
* associated filter apply.
*/
action?: SqlAction;
/**
* @internal
* @ignore
* Name of topic
*/
topicName: string;
/**
* @internal
* @ignore
* Name of subscription
*/
subscriptionName: string;
/**
* @internal
* @ignore
* Created at timestamp
*/
createdOn: string;
}
/**
* Options for `SbClient`
*
* # Sharing resources with `SgServer`:
*
* When both `SgServer` and `SgClient` are used you can link the two together to allow sharing of resources.
* This will allow sharing the connection, including credentials for both underlying client & managements connections.
*
* To link `SgServer` and `SgClient`:
*
* - Make sure that the identifiers `SbServerOptions.name` & `SgClientOptions.name` are identical.
* - Make sure `SgClientOptions.client` is not set.
*
* By default, both identifiers are not set which means that the link is activated unless `SgClientOptions.client` is set.
*
* Note that this apply to `SgClientOptions.management` as well.
*/
export declare interface SbClientOptions {
/**
* A unique name given to this client which allow referencing a specific client to be used by an emitter.
* In addition, the name is used to pair server & client together to allow sharing of resources (connections/senders/receivers).
*
* By default the name is undefined, which is the identifier for the default client.
* In most cases a multi-client environment is not required and you will not use the name, this means that:
*
* - All servers & clients are shared (unless a `client` is specified explicitly)
* - All emitters will use the default client (unless an emitter specify a client reference explicitly)
*
* Note that the name most be unique across all running instances.
* This means that only one default (empty name) server is allowed.
* If a duplicate name is detected the process will throw.
*/
name?: string;
/**
* Client information used to authenticate, authorize & connect with service bus.
*
* The information might be optional if the client is shared with an active `SgServer` instance.
* In that case, resources are shared between the two.
*
* See `SbClientOptions.name` for more information.
*/
client?: SbConnectionOptions;
management?: SbManagementClientOptions[keyof SbManagementClientOptions];
logger?: SbLogger;
}
declare interface SbConnectionOptions {
/**
* Connection credentials used to authenticate & authorize with service bus.
*/
credentials: TCredentials;
/**
* Connection specific options
*/
options?: TOptions;
}
export declare class SbContext {
private readonly metadata;
private readonly message;
readonly logger: SbLogger;
get type(): T;
get metadataOptions(): SbSubscriptionMetadataOptions | SbQueueSubscriptionMetadataOptions;
constructor(metadata: SbSubscriberMetadata, message: ServiceBusMessage, logger: SbLogger);
getData(): TBody;
getMessage(): ServiceBusMessage;
/**
* The entity name used to identify subscription/queue in service bus
*/
entityName(): string;
/**
* Try to resolves a client (queue or topic emitter/sender) based on the entity name.
*
* If an entity reference is not provided, the default reference is the entity used to emit messages to this subscriber.
* If this is a queue subscriber, it will be a queue emitter. If this is a subscription, it will be the topic of the subscription.
*
* > You can also provide a clientId to look the entity in.
*/
resolveClient(emitterReference?: SbEmitterRef): SbEmitterImp | undefined;
}
export declare type SbContextArgs = [SbSubscriberMetadata, ServiceBusMessage];
export declare type SbCorrelationFilter = Partial;
declare type SbCredentials = ServiceBusAadTokenCredentials | ServiceBusTokenProviderCredentials | ServiceBusConnectionStringCredentials;
declare class SbDiscoveryService {
readonly configuration: AttribusConfiguration;
private server;
private client;
constructor(configuration: AttribusConfiguration);
init(): void;
discover(): Promise;
destroy(): Promise;
protected build(): Promise;
protected tryGetTargetMetadata(ctor: Ctor): MetadataTarget;
}
/**
* Represents an object that can emit service bus message. (I.E a service bus `Sender`)
*/
export declare interface SbEmitterImp extends Sender {
}
declare class SbEmitterMetadata {
readonly type: T;
static is(obj: any): obj is SbEmitterMetadata;
get ready(): boolean;
metaOptions: SbEmitterTypeMap[T] extends SbEmitterMetadataOptions ? SbEmitterTypeMap[T] : SbEmitterMetadataOptions;
private _ready;
constructor(type: T, metaOptions: SbEmitterTypeMap[T] extends SbEmitterMetadataOptions ? SbEmitterTypeMap[T] : never);
init(): Promise;
}
export declare interface SbEmitterMetadataOptions {
name: string;
/**
* The unique id of the client that this emitter should use as the underlying emitter.
* This should match the client name defined in `SgClientOptions.name`.
*
* By default `SgClientOptions.name` is not set, which is the identifier for the default client.
* A multi-client environment is not required in most of the scenarios, if that is the case do not set this value.
*/
clientId?: string;
}
/**
* A Reference to an existing client emitter.
* This is basically a query to get the service bus `Sender` instance for the client registered at the
* queue / topic name.
*
* Note that if you're using unique client name you can also provide the specific client id to target.
*
* Type (topic/queue) is irrelevant because in any case two identical entities can not share the same name
* event if they are of different type.
*/
export declare type SbEmitterRef = SbEmitterMetadataOptions;
declare interface SbEmitterTypeMap {
queue: SbQueueMetadataOptions;
topic: SbTopicMetadataOptions;
}
declare interface SbEntityProvision {
/**
* The provisioning type
*
* - skip: no provisioning
* - verify: verify that the entity exists
* - verifyCreate: verify that the entity exists and create it if not
*/
type: SgEntityProvisionType;
/**
* The entity to create/update (e.g. SBQuery, SBTopic, etc...)
*/
params?: T;
}
export declare type SbEntityProvisionOption> = SgEntityProvisionType | T;
export declare class SbErrorEvent {
readonly phase: 'verify' | 'register' | 'listening';
readonly options: SbQueueMetadataOptions | SbSubscriptionMetadataOptions;
readonly error: Error | MessagingError;
constructor(phase: 'verify' | 'register' | 'listening', options: SbQueueMetadataOptions | SbSubscriptionMetadataOptions, error: Error | MessagingError);
}
export declare abstract class SbErrorHandler {
abstract onError(event: SbErrorEvent): Promise;
abstract onMessageError(event: SbMessageErrorEvent): Promise;
}
export declare function SbIntercept(...interceptors: Array): , any>>, K extends string>(target: T, key: K) => void;
export declare interface SbInterceptor {
intercept(context: SbContext, next: NextInterceptor): Observable | Promise>;
}
declare type SbLinkedEntityProvisionOption = T extends 'queue' ? {
type: 'queue';
provision: SbEntityProvisionOption;
} : {
type: 'topic';
provision: SbEntityProvisionOption;
};
declare interface SbLogger {
log(message: any, context?: string): any;
error(message: any, trace?: string, context?: string): any;
warn(message: any, context?: string): any;
debug?(message: any, context?: string): any;
verbose?(message: any, context?: string): any;
}
export declare interface SbManagementClientAtomOptions extends SbConnectionOptions {
defaults?: SbManagementDefaultsAdapter;
}
export declare interface SbManagementClientOptions {
}
export declare interface SbManagementDefaultsAdapter {
entities?: {
queue?: SbQueue;
topic?: SbTopic;
subscription?: SbSubscription;
};
/**
* A function that can be used to create default set of rules that will be added when a new subscription is created.
* This function, when set, is fired at all time even if the user defined a static array or a dynamic function for the rules.
*
* If the user provision defines a function for the rules it will be fired first and after that the default rules function will fire.
*
* The rules from the user's provision is passed to this function and the result from this function will be used as the resolved rules
* for the subscription. I.E., for pass-through make sure you return the `providedRules array.
*
* @param topicName The name of the topic grandparent
* @param subscriptionName The name of subscription parent
* @param providedRules The list of rules defined by the user
* @param subscriptionProvision The provision of the subscription created
*/
onNewSubscriptionRules?(topicName: string, subscriptionName: string, providedRules: SbRuleEntityProvision[], subscriptionProvision: SbTopicSubscriptionEntityProvision): SbRuleEntityProvision[];
}
/**
* Represents an object that can be used (directly or indirectly) to emit messages to service bus.
* This can be either a directly emitting object or a reference that is used to resolve a directly emitting object.
*/
export declare type SbMessageEmitter = SbEmitterRef | SbEmitterImp;
export declare class SbMessageErrorEvent {
readonly options: SbQueueMetadataOptions | SbSubscriptionMetadataOptions;
readonly error: Error;
readonly message: ServiceBusMessage;
constructor(options: SbQueueMetadataOptions | SbSubscriptionMetadataOptions, error: Error, message: ServiceBusMessage);
}
export declare type SbQueue = Partial>;
export declare interface SbQueueEntityProvision extends SbEntityProvision {
/**
* Define how the forward queue/topic is provisioned ("forwardTo")
* > Relevant only when "forwardTo" has a value.
* @defaultValue skip (the actual default value is undefined, since it's unclear if the entity is a queue or a topic we must skip)
*/
forward?: SbLinkedEntityProvisionOption;
/**
* Define how the dead letter queue/topic is provisioned ("forwardDeadLetteredMessagesTo")
* > Relevant only when "forwardDeadLetteredMessagesTo" has a value.
* @defaultValue skip (the actual default value is undefined, since it's unclear if the entity is a queue or a topic we must skip)
*/
deadLetter?: SbLinkedEntityProvisionOption;
}
export declare interface SbQueueMetadataOptions extends SbEmitterMetadataOptions {
provision?: SbEntityProvisionOption;
}
export declare interface SbQueueSubscriptionMetadataOptions extends SbSubscriberMetadataOptions {
provision?: SbEntityProvisionOption;
}
export declare type SbRule = Partial>;
export declare interface SbRuleEntityProvision extends SbEntityProvision {
ruleName: string;
params: SbRule;
}
export declare interface SbServerOptions {
/**
* A unique name given to this server which allow subscriber filter and other paring capabilities.
* When not set, the server is defined as the default server used for all events defined without filtering.
*
* Additionally, the name is used to pair server & client together to allow sharing of resources (connections/senders/receivers).
* Since by default all names are empty, all servers & clients are shared.
*
* Note that the name most be unique across all running instances
* This means that only one default (empty name) server is allowed.
*
* If a duplicate name is detected the process will throw.
*/
name?: string;
client: SbConnectionOptions;
management?: SbManagementClientOptions[keyof SbManagementClientOptions];
/**
* How handlers are registers in service bus.
* - sequence: register one after the other
* - parallel: register all at once
*
* The default value is parallel
*/
registerHandlers?: 'sequence' | 'parallel';
logger?: SbLogger;
}
export declare type SbSqlFilter = Partial>;
declare class SbSubscriberMetadata {
readonly type: T;
readonly descriptor?: PropertyDescriptor;
static is(obj: any): obj is SbSubscriberMetadata;
readonly handlerType: 'method' | 'pipe';
readonly interceptors: Array;
get ready(): boolean;
metaOptions: SbSubscriberTypeMap[T] extends SbSubscriberMetadataOptions ? SbSubscriberTypeMap[T] : SbSubscriberMetadataOptions;
private _ready;
constructor(type: T, metaOptions: SbSubscriberTypeMap[T] extends SbSubscriberMetadataOptions ? SbSubscriberTypeMap[T] : never, descriptor?: PropertyDescriptor);
addInterceptors(interceptors: Array): void;
init(): Promise;
}
export declare interface SbSubscriberMetadataOptions {
name: string;
receiveMode: ReceiveMode;
handlerOptions?: MessageHandlerOptions;
sessionOptions?: SessionReceiverOptions;
/**
* When true, will not forward/propagate errors thrown from within the handler to service bus. It will swallow the error
* letting `@azure/service-bus` think there are no errors.
*
* > This is an advanced setting which requires complete understanding of how `@azure/service-bus` handle the handlers.
*
* ## Background
*
* Service bus invokes all handlers within a try/catch block and each error is handled based on the following (simple) logic:
*
* 1. Invoke the handler
*
* 2. If error:
* A. Let the user error handler know about it (sync call to `onError` in `registerMessageHandler`) [Step skipped if it's an AMQP error]
* B. If `receiveMode` is `peekLock` and the message had not settled - Automatically abandon the message
* This step is here to prevent waiting for the lock on the message to end, retuning it to the queue immediately.
* Nice, but can not be configured, will be done on every error in `peekLock`
* Note that this process is async but not manageable, you never know when it ended, only if it errors the `onError` will invoke.
* C. Stop the handling process
*
* 3. If no error:
* A. If `receiveMode` is `peekLock` and `autoComplete` is on (default), complete the message
* This one is configurable, by setting `autoComplete` to false it will not fire.
* However, when it does, same as above, no control over the process it fires and you can't tell when it ends.
* If it throws, `onError` is invoked.
*
* ## Problem
*
* How can we avoid the automatic abandoning of the message in `peekLock` mode?
* What if we want to complete the message and not abandon it? how can we get notified when abandon process has completed?
*
* ## Solution
*
* Catch the error before it propagates and hide it as nothing happened.
* Because we can't just hide errors, we will still notify the `onError` with the error (Allowing handling of it on the SbErrorHandler registered).
*
* - The error notification will now fire async, using the `SbErrorHandler.onMessageError`, allowing fine tune control over the process.
* - If you re-throw from the error handler you will revert back (just this one time) to the old behavior, using the original logic
*
* > NOTE that throwing from the error handler will result in the same error pushed back to the error handler by the service bus logic
*
* ## Risks
*
* Because we are hiding the error, service bus will think the message was processed correctly and will initiate a complete to the message
* if we're in `peekLock` mode and `autoComplete` is enabled.
* This is SUPER RISKY because it effects logic.
*
* This is why it is not possible to swallow errors when `autoComplete` is enabled in `peekLock` mode just by setting `swallowErrors` to `true`.
* If you set `swallowErrors` to `true` while `autoComplete` is enabled in `peekLock` mode the process will throw!
*
* To enable `swallowErrors` while `autoComplete` is enabled in `peekLock` mode you need to specifically set the value `swallowAndAutoComplete` to
* `swallowErrors`
*
* When using this solution to
*
* @default false
*/
swallowErrors?: boolean | 'swallowAndAutoComplete';
/**
* The unique id of the server that this emitter should use as the underlying listener.
* This should match the server name defined in `SgServerOptions.name`.
*
* By default `SgServerOptions.name` is not set, which is the identifier for the default server.
* A multi-server environment is not required in most of the scenarios, if that is the case do not set this value.
*/
serverId?: string;
}
declare interface SbSubscriberTypeMap {
queue: SbQueueSubscriptionMetadataOptions;
subscription: SbSubscriptionMetadataOptions;
}
export declare type SbSubscription = Partial>;
export declare interface SbSubscriptionMetadataOptions extends SbSubscriberMetadataOptions {
topicName: string;
provision?: SbEntityProvisionOption;
}
export declare type SbTopic = Partial>;
export declare interface SbTopicEntityProvision extends SbEntityProvision {
}
export declare interface SbTopicMetadataOptions extends SbEmitterMetadataOptions {
provision?: SbEntityProvisionOption;
}
export declare interface SbTopicSubscriptionEntityProvision extends SbEntityProvision {
/**
* Define how the topic for this subscription is provisioned.
* Unlike "deadLetter", the default behavior is "skip" as it is usually the role of the topic's owner to create it.
*
* @defaultValue to "skip"
*/
topic?: SbEntityProvisionOption;
/**
* Define how the forward queue/topic is provisioned ("forwardTo")
* > Relevant only when "forwardTo" has a value.
* @defaultValue skip (the actual default value is undefined, since it's unclear if the entity is a queue or a topic we must skip)
*/
forward?: SbLinkedEntityProvisionOption;
/**
* Define how the dead letter topic is provisioned ("forwardDeadLetteredMessagesTo")
* > Relevant only when "forwardDeadLetteredMessagesTo" has a value.
* @defaultValue skip (the actual default value is undefined, since it's unclear if the entity is a queue or a topic we must skip)
*/
deadLetter?: SbLinkedEntityProvisionOption;
/**
* A list of rules (actions/filters) to apply to the subscription or, a function that results a list of rules dynamically.
*/
rules?: SbRuleEntityProvision[] | ((topicName: string, subscriptionName: string) => SbRuleEntityProvision[]);
}
export declare interface ServiceBusAadTokenCredentials {
/**
* Fully qualified domain name for ServiceBus.
* Most likely, {yournamespace}.servicebus.windows.net
*/
host: string;
/**
* The Token credentials generated by using the * `@azure/ms-rest-nodeauth` library.
* It can be one of the following:
* - ApplicationTokenCredentials
* - UserTokenCredentials
* - DeviceTokenCredentials
* - MSITokenCredentials Token audience (or resource in case of MSI based credentials) to use when creating the credentials is https://servicebus.azure.net/
*/
credentials: Parameters[1];
}
/**
* @internal
* @ignore
* Options to use with ServiceBusAtomManagementClient creation
*/
declare interface ServiceBusAtomManagementClientOptions {
/**
* Proxy related settings
*/
proxySettings?: ProxySettings;
}
export declare interface ServiceBusConnectionStringCredentials {
connectionString: string;
}
export declare interface ServiceBusManagementAadTokenCredentials extends ServiceBusAadTokenCredentials {
resourceGroupName: string;
namespace: string;
subscriptionId: string;
}
export declare interface ServiceBusTokenProviderCredentials {
host: string;
tokenProvider: TokenProvider;
}
declare type SgEntityProvisionType = 'verify' | 'verifyCreate' | 'skip';
/**
* @internal
* @ignore
* Represents all possible fields on SqlAction
*/
declare type SqlAction = SqlFilter;
/**
* @internal
* @ignore
* Represents all possible fields on SqlFilter
*/
declare interface SqlFilter {
/**
* @internal
* @ignore
* SQL expression to use.
*/
sqlExpression?: string;
/**
* @internal
* @ignore
* SQL parameters to the expression
*/
sqlParameters?: SqlParameter[];
/**
* @internal
* @ignore
* This property is reserved for future use. An integer value showing the
* compatibility level, currently hard-coded to 20.
*/
compatibilityLevel?: number;
/**
* @internal
* @ignore
* Boolean value indicating whether the SQL filter expression requires preprocessing
*/
requiresPreprocessing?: boolean;
}
/**
* @internal
* @ignore
* Represents type of SQL `Parameter` in ATOM based management operations
*/
declare type SqlParameter = {
key: string;
value: string | number;
type: string;
};
/**
* Subscribes to incoming events from a topic
*/
export declare function Subscription(metadata: SbSubscriptionMetadataOptions): PropOrMethodDecorator;
/**
* @internal
* @ignore
* Represents all attributes of a subscription entity
*/
declare interface SubscriptionDetails {
/**
* Name of the subscription
*/
subscriptionName: string;
/**
* Name of the topic
*/
topicName: string;
/**
* The default lock duration is applied to subscriptions that do not define a
* lock duration.
* Settable only at subscription creation time.
* This is specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*/
lockDuration: string;
/**
* The entity's size in bytes.
*
*/
sizeInBytes?: number;
/**
* 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 entity's message count.
*
*/
messageCount: number;
/**
* Specifies whether the topic should be partitioned
*/
enablePartitioning?: boolean;
/**
* 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;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations: 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 dead-letter sub-queue or permanently deleted.
* This is to be specified in ISO-8601 duration format
* such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
*/
defaultMessageTtl?: string;
/**
* Indicates the default rule description.
*
*/
defaultRuleDescription?: any;
/**
* 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.
*/
autoDeleteOnIdle: 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;
/**
* 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:///`
*/
forwardDeadLetteredMessagesTo?: 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;
/**
* 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:///`
*/
forwardTo?: string;
/**
* The user provided metadata information associated with the subscription description.
* Used to specify textual content such as tags, labels, etc.
* Value must not exceed 1024 bytes encoded in utf-8.
*/
userMetadata?: string;
/**
* Message count details
*/
messageCountDetails?: MessageCountDetails;
/**
* Entity availability status
*/
entityAvailabilityStatus: string;
/**
* Status of the messaging entity.
*/
status?: EntityStatus;
/**
* Created at timestamp
*/
createdOn: string;
/**
* Updated at timestamp
*/
updatedOn: string;
/**
* Accessed at timestamp
*/
accessedOn?: string;
}
/**
* Subscribes to incoming events from a topic
*/
export declare const Topic: (metadata: SbTopicMetadataOptions) => PropertyDecorator;
/**
* @internal
* @ignore
* Represents all attributes of a topic entity
*/
declare interface TopicDetails {
/**
* Name of the topic
*/
topicName: string;
/**
* Specifies the topic size in bytes.
*/
sizeInBytes?: number;
/**
* 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;
/**
* 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;
/**
* Enable Subscription Partitioning option
*/
enableSubscriptionPartitioning?: boolean;
/**
* Filtering Messages Before Publishing option
*/
filteringMessagesBeforePublishing?: boolean;
/**
* Authorization rules on the topic
*/
authorizationRules?: AuthorizationRule[];
/**
* Specifies whether the topic should be partitioned
*/
enablePartitioning: boolean;
/**
* Specifies whether the topic supports message ordering.
*/
supportOrdering: boolean;
/**
* Specifies if batched operations should be allowed.
*/
enableBatchedOperations: 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.
*/
autoDeleteOnIdle?: string;
/**
* The entity's message count.
*
*/
messageCount?: number;
/**
* The subscription count on given topic.
*
*/
subscriptionCount?: number;
/**
* The maximum delivery count of messages after which if it is still not settled,
* gets moved to the dead-letter sub-queue.
*
*/
maxDeliveryCount?: number;
/**
* 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.
*/
defaultMessageTtl: string;
/**
* 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.
*/
duplicateDetectionHistoryTimeWindow: string;
/**
* The user provided metadata information associated with the topic description.
* Used to specify textual content such as tags, labels, etc.
* Value must not exceed 1024 bytes encoded in utf-8.
*/
userMetadata?: string;
/**
* Is Express option
*/
isExpress?: boolean;
/**
* Enable express option
*/
enableExpress?: boolean;
/**
* Message count details
*/
messageCountDetails?: MessageCountDetails;
/**
* Is anonymous accessible topic option
*/
isAnonymousAccessible?: boolean;
/**
* Entity availability status
*/
entityAvailabilityStatus?: string;
/**
* Status of the messaging entity.
*/
status?: EntityStatus;
/**
* Created at timestamp
*/
createdOn?: string;
/**
* Updated at timestamp
*/
updatedOn?: string;
/**
* Accessed at timestamp
*/
accessedOn?: string;
}
export { }