@azure/service-bus 7.10.0-alpha.20240507.1 → 7.10.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -163,9 +163,9 @@ export class ServiceBusReceiverImpl {
163
163
  beforeEnqueueTime: options?.beforeEnqueueTime,
164
164
  });
165
165
  logger.verbose(`${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`);
166
- if (deletedCount === MaxDeleteMessageCount) {
167
- let batchCount = MaxDeleteMessageCount;
168
- while (batchCount === MaxDeleteMessageCount) {
166
+ if (deletedCount > 0) {
167
+ let batchCount = deletedCount;
168
+ while (batchCount > 0) {
169
169
  batchCount = await this.deleteMessages({
170
170
  maxMessageCount: MaxDeleteMessageCount,
171
171
  beforeEnqueueTime: options?.beforeEnqueueTime,
@@ -1 +1 @@
1
- {"version":3,"file":"receiver.js","sourceRoot":"","sources":["../../../src/receivers/receiver.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,qCAAqC,GACtC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAe,kBAAkB,EAAgB,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,wBAAwB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O;IACT,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PeekMessagesOptions,\n GetMessageIteratorOptions,\n MessageHandlers,\n ReceiveMessagesOptions,\n SubscribeOptions,\n DeleteMessagesOptions,\n PurgeMessagesOptions,\n} from \"../models\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { ServiceBusReceivedMessage } from \"../serviceBusMessage\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport {\n getAlreadyReceivingErrorMsg,\n getReceiverClosedErrorMsg,\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwErrorIfInvalidOperationOnMessage,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { ReceiveOptions } from \"../core/messageReceiver\";\nimport { StreamingReceiver } from \"../core/streamingReceiver\";\nimport { BatchingReceiver } from \"../core/batchingReceiver\";\nimport {\n abandonMessage,\n assertValidMessageHandlers,\n completeMessage,\n deadLetterMessage,\n deferMessage,\n getMessageIterator,\n} from \"./receiverCommon\";\nimport Long from \"long\";\nimport { ServiceBusMessageImpl, DeadLetterOptions } from \"../serviceBusMessage\";\nimport { Constants, RetryConfig, RetryOperationType, RetryOptions, retry } from \"@azure/core-amqp\";\nimport { LockRenewer } from \"../core/autoLockRenewer\";\nimport { receiverLogger as logger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport { ensureValidIdentifier } from \"../util/utils\";\nimport { toSpanOptions, tracingClient } from \"../diagnostics/tracing\";\nimport { extractSpanContextFromServiceBusMessage } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { TracingSpanLink } from \"@azure/core-tracing\";\n\n/**\n * The default time to wait for messages _after_ the first message\n * has been received.\n *\n * This timeout only applies to receiveMessages()\n *\n * @internal\n */\nexport const defaultMaxTimeAfterFirstMessageForBatchingMs = 1000;\n\n/**\n * The maximum number of messages to delete in a single batch. This cap is established and enforced by the service.\n * @internal\n */\nexport const MaxDeleteMessageCount = 4000;\n\n/**\n * A receiver that does not handle sessions.\n */\nexport interface ServiceBusReceiver {\n /**\n * A name used to identify the receiver. This can be used to correlate logs and exceptions.\n * If not specified or empty, a random unique one will be generated.\n */\n identifier: string;\n\n /**\n * Streams messages to message handlers.\n * @param handlers - A handler that gets called for messages and errors.\n * @param options - Options for subscribe.\n * @returns An object that can be closed, sending any remaining messages to `handlers` and\n * stopping new messages from arriving.\n */\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n /**\n * Causes the subscriber to stop receiving new messages.\n */\n close(): Promise<void>;\n };\n\n /**\n * Returns an iterator that can be used to receive messages from Service Bus.\n *\n * @param options - A set of options to control the receive operation.\n * - `abortSignal`: The signal to use to abort the ongoing operation.\n *\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws Error if current receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages.\n */\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage>;\n\n /**\n * Returns a promise that resolves to an array of messages received from Service Bus.\n *\n * @param maxMessageCount - The maximum number of messages to receive.\n * @param options - A set of options to control the receive operation.\n * - `maxWaitTimeInMs`: The maximum time to wait for the first message before returning an empty array if no messages are available.\n * - `abortSignal`: The signal to use to abort the ongoing operation.\n * @returns A promise that resolves with an array of messages.\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws Error if current receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages.\n */\n receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Returns a promise that resolves to an array of deferred messages identified by given `sequenceNumbers`.\n * @param sequenceNumbers - The sequence number or an array of sequence numbers for the messages that need to be received.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns A list of messages identified by the given sequenceNumbers or an empty list if no messages are found.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while receiving deferred messages.\n */\n receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options?: OperationOptionsBase,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Peek the next batch of active messages (including deferred but not deadlettered messages) on the\n * queue or subscription without modifying them.\n * - The first call to `peekMessages()` fetches the first active message. Each subsequent call fetches the\n * subsequent message.\n * - Unlike a \"received\" message, \"peeked\" message is a read-only version of the message.\n * It cannot be `Completed/Abandoned/Deferred/Deadlettered`.\n * @param maxMessageCount - The maximum number of messages to peek.\n * @param options - Options that allow to specify the maximum number of messages to peek,\n * the sequenceNumber to start peeking from or an abortSignal to abort the operation.\n */\n peekMessages(\n maxMessageCount: number,\n options?: PeekMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Delete messages. If no option is specified, all messages will be deleted.\n *\n * @param options - Options to configure the operation.\n * @returns number of messages that have been deleted.\n */\n deleteMessages(options: DeleteMessagesOptions): Promise<number>;\n\n /**\n * Attempts to purge all messages from an entity. Locked messages are not eligible for removal and\n * will remain in the entity.\n *\n * @param options - Options that allow to specify the cutoff time for deletion. Only messages that were enqueued\n * before this time will be deleted. If not specified, current time will be used.\n * @returns number of messages deleted.\n */\n purgeMessages(options?: PurgeMessagesOptions): Promise<number>;\n\n /**\n * Path of the entity for which the receiver has been created.\n */\n entityPath: string;\n /**\n * The receive mode used to create the receiver.\n */\n receiveMode: \"peekLock\" | \"receiveAndDelete\";\n /**\n * Returns `true` if either the receiver or the client that created it has been closed.\n * @readonly\n */\n isClosed: boolean;\n /**\n * Closes the receiver.\n * Once closed, the receiver cannot be used for any further operations.\n * Use the `createReceiver()` method on the ServiceBusClient to create a new Receiver.\n */\n close(): Promise<void>;\n /**\n * Removes the message from Service Bus.\n *\n * @throws Error with name `SessionLockLostError` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws Error with name `MessageLockLostError` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws Error with name `ServiceUnavailableError` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n */\n completeMessage(message: ServiceBusReceivedMessage): Promise<void>;\n /**\n * The lock held on the message by the receiver is let go, making the message available again in\n * Service Bus for another receive operation.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param propertiesToModify - The properties of the message to modify while abandoning the message.\n */\n abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Defers the processing of the message. Save the `sequenceNumber` of the message, in order to\n * receive it message again in the future using the `receiveDeferredMessage` method.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param propertiesToModify - The properties of the message to modify while deferring the message\n */\n deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Moves the message to the deadletter sub-queue. To receive a deadletted message, create a new\n * QueueClient/SubscriptionClient using the path for the deadletter sub-queue.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param options - The DeadLetter options that can be provided while\n * rejecting the message.\n */\n deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Renews the lock on the message for the duration as specified during the Queue/Subscription\n * creation.\n * - Check the `lockedUntilUtc` property on the message for the time when the lock expires.\n * - If a message is not settled (using either `complete()`, `defer()` or `deadletter()`,\n * before its lock expires, then the message lands back in the Queue/Subscription for the next\n * receive operation.\n *\n * @returns New lock token expiry date and time in UTC format.\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws ServiceBusError if the service returns an error while renewing message lock.\n */\n renewMessageLock(message: ServiceBusReceivedMessage): Promise<Date>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusReceiverImpl implements ServiceBusReceiver {\n public identifier: string;\n private _retryOptions: RetryOptions;\n /**\n * Denotes if close() was called on this receiver\n */\n private _isClosed: boolean = false;\n\n /**\n * Instance of the BatchingReceiver class to use to receive messages in pull mode.\n */\n private _batchingReceiver?: BatchingReceiver;\n\n /**\n * Instance of the StreamingReceiver class to use to receive messages in push mode.\n */\n private _streamingReceiver?: StreamingReceiver;\n private _lockRenewer: LockRenewer | undefined;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|receiver:${this.entityPath}]`;\n }\n\n /**\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n public entityPath: string,\n public receiveMode: \"peekLock\" | \"receiveAndDelete\",\n maxAutoRenewLockDurationInMs: number,\n private skipParsingBodyAsJson: boolean,\n private skipConvertingDate: boolean = false,\n retryOptions: RetryOptions = {},\n identifier?: string,\n ) {\n throwErrorIfConnectionClosed(_context);\n this._retryOptions = retryOptions;\n this._lockRenewer = LockRenewer.create(\n this._context,\n maxAutoRenewLockDurationInMs,\n receiveMode,\n );\n this.identifier = ensureValidIdentifier(this.entityPath, identifier);\n }\n\n private _throwIfAlreadyReceiving(): void {\n if (this._isReceivingMessages()) {\n const errorMessage = getAlreadyReceivingErrorMsg(this.entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is already receiving`);\n throw error;\n }\n }\n\n private _throwIfReceiverOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n const errorMessage = getReceiverClosedErrorMsg(this.entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is closed`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n async receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const receiveMessages = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (!this._batchingReceiver || !this._context.messageReceivers[this._batchingReceiver.name]) {\n const receiveOptions: ReceiveOptions = {\n maxConcurrentCalls: 0,\n receiveMode: this.receiveMode,\n lockRenewer: this._lockRenewer,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n };\n this._batchingReceiver = this._createBatchingReceiver(\n this._context,\n this.entityPath,\n receiveOptions,\n );\n }\n\n const receivedMessages = await this._batchingReceiver.receive(\n maxMessageCount,\n options?.maxWaitTimeInMs ?? Constants.defaultOperationTimeoutInMs,\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n options ?? {},\n );\n\n return receivedMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n connectionHost: this._context.config.host,\n connectionId: this._context.connectionId,\n operation: receiveMessages,\n operationType: RetryOperationType.receiveMessage,\n abortSignal: options?.abortSignal,\n retryOptions: this._retryOptions,\n };\n return retry<ServiceBusReceivedMessage[]>(config).catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage> {\n return getMessageIterator(this, options);\n }\n\n async receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const deferredSequenceNumbers = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const receiveDeferredMessagesOperationPromise = async (): Promise<\n ServiceBusReceivedMessage[]\n > => {\n const deferredMessages = await this._context\n .getManagementClient(this.entityPath)\n .receiveDeferredMessages(deferredSequenceNumbers, this.receiveMode, undefined, {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"receiveDeferredMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n });\n return deferredMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveDeferredMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async deleteMessages(options: DeleteMessagesOptions): Promise<number> {\n this._throwIfReceiverOrConnectionClosed();\n\n const deleteMessagesOperationPromise = (): Promise<number> => {\n return this._context\n .getManagementClient(this.entityPath)\n .deleteMessages(options.maxMessageCount, options?.beforeEnqueueTime, undefined, {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"deleteMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<number> = {\n operation: deleteMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<number>(config);\n }\n\n async purgeMessages(options?: PurgeMessagesOptions): Promise<number> {\n let deletedCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`,\n );\n if (deletedCount === MaxDeleteMessageCount) {\n let batchCount = MaxDeleteMessageCount;\n while (batchCount === MaxDeleteMessageCount) {\n batchCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${batchCount} messages.`,\n );\n deletedCount += batchCount;\n }\n }\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' purged ${deletedCount} messages.`,\n );\n return deletedCount;\n }\n\n // ManagementClient methods # Begin\n\n async peekMessages(\n maxMessageCount: number,\n options: PeekMessagesOptions = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n\n const managementRequestOptions = {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"peekMessages\",\n timeoutInMs: this._retryOptions?.timeoutInMs,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n };\n const peekOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (options.fromSequenceNumber !== undefined) {\n return this._context\n .getManagementClient(this.entityPath)\n .peekBySequenceNumber(\n options.fromSequenceNumber,\n maxMessageCount,\n undefined,\n options.omitMessageBody,\n managementRequestOptions,\n );\n } else {\n return this._context\n .getManagementClient(this.entityPath)\n .peek(maxMessageCount, options.omitMessageBody, managementRequestOptions);\n }\n };\n\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: peekOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n close(): Promise<void>;\n } {\n assertValidMessageHandlers(handlers);\n throwErrorIfConnectionClosed(this._context);\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n\n options = {\n ...(options ?? {}),\n autoCompleteMessages: options?.autoCompleteMessages ?? true,\n };\n\n // When the user \"stops\" a streaming receiver (via the returned instance from 'subscribe' we just suspend\n // it, leaving the link open). This allows users to stop the flow of messages but still be able to settle messages\n // since the link itself hasn't been shut down.\n //\n // Users can, if they want, restart their subscription (since we've got a link already established).\n // So you'll have an instance here if the user has done:\n // 1. const subscription = receiver.subscribe()\n // 2. subscription.stop()\n // 3. receiver.subscribe()\n\n this._streamingReceiver =\n this._streamingReceiver ??\n new StreamingReceiver(this.identifier, this._context, this.entityPath, {\n ...options,\n receiveMode: this.receiveMode,\n retryOptions: this._retryOptions,\n lockRenewer: this._lockRenewer,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n });\n\n // this ensures that if the outer service bus client is closed that this receiver is cleaned up.\n // this mostly affects us if we're in the middle of init() - the connection (and receiver) are not yet\n // open but we do need to close the receiver to exit the init() loop.\n this._context.messageReceivers[this._streamingReceiver.name] = this._streamingReceiver;\n\n this._streamingReceiver.subscribe(handlers, options).catch((_) => {\n // (the error will already have been reported to the user)\n if (this._streamingReceiver) {\n delete this._context.messageReceivers[this._streamingReceiver.name];\n }\n });\n\n return {\n close: async (): Promise<void> => {\n return this._streamingReceiver?.stopReceivingMessages();\n },\n };\n }\n\n async completeMessage(message: ServiceBusReceivedMessage): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return completeMessage(msgImpl, this._context, this.entityPath, this._retryOptions);\n }\n\n async abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return abandonMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deferMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deadLetterMessage(msgImpl, this._context, this.entityPath, options, this._retryOptions);\n }\n\n async renewMessageLock(message: ServiceBusReceivedMessage): Promise<Date> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n\n return tracingClient.withSpan(\n \"ServiceBusReceiver.renewMessageLock\",\n {},\n () => {\n const msgImpl = message as ServiceBusMessageImpl;\n\n let associatedLinkName: string | undefined;\n if (msgImpl.delivery.link) {\n const associatedReceiver = this._context.getReceiverFromCache(msgImpl.delivery.link.name);\n associatedLinkName = associatedReceiver?.name;\n }\n return this._context\n .getManagementClient(this.entityPath)\n .renewLock(message.lockToken!, { associatedLinkName })\n .then((lockedUntil) => {\n message.lockedUntilUtc = lockedUntil;\n return lockedUntil;\n });\n },\n {\n spanLinks,\n ...toSpanOptions(\n { entityPath: this.entityPath, host: this._context.config.host },\n \"receive\",\n \"client\",\n ),\n },\n );\n }\n\n async close(): Promise<void> {\n try {\n this._isClosed = true;\n if (this._context.connection && this._context.connection.isOpen()) {\n // Close the streaming receiver.\n if (this._streamingReceiver) {\n await this._streamingReceiver.close();\n }\n\n // Close the batching receiver.\n if (this._batchingReceiver) {\n await this._batchingReceiver.close();\n }\n }\n } catch (err: any) {\n logger.logError(err, `${this.logPrefix} An error occurred while closing the Receiver`);\n throw err;\n }\n }\n\n /**\n * Indicates whether the receiver is currently receiving messages or not.\n * When this returns true, new `registerMessageHandler()` or `receiveMessages()` calls cannot be made.\n */\n private _isReceivingMessages(): boolean {\n if (\n this._streamingReceiver &&\n this._streamingReceiver.isOpen() &&\n this._streamingReceiver.isSubscribeActive\n ) {\n return true;\n }\n if (\n this._batchingReceiver &&\n this._batchingReceiver.isOpen() &&\n this._batchingReceiver.isReceivingMessages\n ) {\n return true;\n }\n return false;\n }\n\n private _createBatchingReceiver(\n context: ConnectionContext,\n entityPath: string,\n options: ReceiveOptions,\n ): BatchingReceiver {\n const receiver = BatchingReceiver.create(this.identifier, context, entityPath, options);\n logger.verbose(\n `[${this.logPrefix}] receiver '${receiver.name}' created, with maxConcurrentCalls set to ${options.maxConcurrentCalls}.`,\n );\n\n return receiver;\n }\n\n /**\n * Helper function to retrieve any active receiver name, regardless of streaming or\n * batching if it exists. This is used for optimization on the service side\n */\n private _getAssociatedReceiverName(): string | undefined {\n if (this._streamingReceiver && this._streamingReceiver.isOpen()) {\n return this._streamingReceiver.name;\n }\n if (\n this._batchingReceiver &&\n this._batchingReceiver.isOpen() &&\n this._batchingReceiver.isReceivingMessages\n ) {\n return this._batchingReceiver.name;\n }\n return;\n }\n}\n"]}
1
+ {"version":3,"file":"receiver.js","sourceRoot":"","sources":["../../../src/receivers/receiver.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,qCAAqC,GACtC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAe,kBAAkB,EAAgB,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4CAA4C,CAAC;AAGrG;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,IAAI,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAgP1C;;GAEG;AACH,MAAM,OAAO,s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B,CAAC,MAAM,EAAE;YAC/B,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAC1C,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,uBAAuB,CAC7B,OAA0B,EAC1B,UAAkB,EAClB,OAAuB;QAEvB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QACxF,MAAM,CAAC,OAAO,CACZ,IAAI,IAAI,CAAC,SAAS,eAAe,QAAQ,CAAC,IAAI,6CAA6C,OAAO,CAAC,kBAAkB,GAAG,CACzH,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACK,0BAA0B;QAChC,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC;YAChE,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;QACtC,CAAC;QACD,IACE,IAAI,CAAC,iBAAiB;YACtB,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE;YAC/B,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAC1C,CAAC;YACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACrC,CAAC;QACD,OAAO;IACT,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PeekMessagesOptions,\n GetMessageIteratorOptions,\n MessageHandlers,\n ReceiveMessagesOptions,\n SubscribeOptions,\n DeleteMessagesOptions,\n PurgeMessagesOptions,\n} from \"../models\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { ServiceBusReceivedMessage } from \"../serviceBusMessage\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport {\n getAlreadyReceivingErrorMsg,\n getReceiverClosedErrorMsg,\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwErrorIfInvalidOperationOnMessage,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { ReceiveOptions } from \"../core/messageReceiver\";\nimport { StreamingReceiver } from \"../core/streamingReceiver\";\nimport { BatchingReceiver } from \"../core/batchingReceiver\";\nimport {\n abandonMessage,\n assertValidMessageHandlers,\n completeMessage,\n deadLetterMessage,\n deferMessage,\n getMessageIterator,\n} from \"./receiverCommon\";\nimport Long from \"long\";\nimport { ServiceBusMessageImpl, DeadLetterOptions } from \"../serviceBusMessage\";\nimport { Constants, RetryConfig, RetryOperationType, RetryOptions, retry } from \"@azure/core-amqp\";\nimport { LockRenewer } from \"../core/autoLockRenewer\";\nimport { receiverLogger as logger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport { ensureValidIdentifier } from \"../util/utils\";\nimport { toSpanOptions, tracingClient } from \"../diagnostics/tracing\";\nimport { extractSpanContextFromServiceBusMessage } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { TracingSpanLink } from \"@azure/core-tracing\";\n\n/**\n * The default time to wait for messages _after_ the first message\n * has been received.\n *\n * This timeout only applies to receiveMessages()\n *\n * @internal\n */\nexport const defaultMaxTimeAfterFirstMessageForBatchingMs = 1000;\n\n/**\n * The maximum number of messages to delete in a single batch. This cap is established and enforced by the service.\n * @internal\n */\nexport const MaxDeleteMessageCount = 4000;\n\n/**\n * A receiver that does not handle sessions.\n */\nexport interface ServiceBusReceiver {\n /**\n * A name used to identify the receiver. This can be used to correlate logs and exceptions.\n * If not specified or empty, a random unique one will be generated.\n */\n identifier: string;\n\n /**\n * Streams messages to message handlers.\n * @param handlers - A handler that gets called for messages and errors.\n * @param options - Options for subscribe.\n * @returns An object that can be closed, sending any remaining messages to `handlers` and\n * stopping new messages from arriving.\n */\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n /**\n * Causes the subscriber to stop receiving new messages.\n */\n close(): Promise<void>;\n };\n\n /**\n * Returns an iterator that can be used to receive messages from Service Bus.\n *\n * @param options - A set of options to control the receive operation.\n * - `abortSignal`: The signal to use to abort the ongoing operation.\n *\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws Error if current receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages.\n */\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage>;\n\n /**\n * Returns a promise that resolves to an array of messages received from Service Bus.\n *\n * @param maxMessageCount - The maximum number of messages to receive.\n * @param options - A set of options to control the receive operation.\n * - `maxWaitTimeInMs`: The maximum time to wait for the first message before returning an empty array if no messages are available.\n * - `abortSignal`: The signal to use to abort the ongoing operation.\n * @returns A promise that resolves with an array of messages.\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws Error if current receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages.\n */\n receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Returns a promise that resolves to an array of deferred messages identified by given `sequenceNumbers`.\n * @param sequenceNumbers - The sequence number or an array of sequence numbers for the messages that need to be received.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns A list of messages identified by the given sequenceNumbers or an empty list if no messages are found.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while receiving deferred messages.\n */\n receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options?: OperationOptionsBase,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Peek the next batch of active messages (including deferred but not deadlettered messages) on the\n * queue or subscription without modifying them.\n * - The first call to `peekMessages()` fetches the first active message. Each subsequent call fetches the\n * subsequent message.\n * - Unlike a \"received\" message, \"peeked\" message is a read-only version of the message.\n * It cannot be `Completed/Abandoned/Deferred/Deadlettered`.\n * @param maxMessageCount - The maximum number of messages to peek.\n * @param options - Options that allow to specify the maximum number of messages to peek,\n * the sequenceNumber to start peeking from or an abortSignal to abort the operation.\n */\n peekMessages(\n maxMessageCount: number,\n options?: PeekMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Delete messages. If no option is specified, all messages will be deleted.\n *\n * @param options - Options to configure the operation.\n * @returns number of messages that have been deleted.\n */\n deleteMessages(options: DeleteMessagesOptions): Promise<number>;\n\n /**\n * Attempts to purge all messages from an entity. Locked messages are not eligible for removal and\n * will remain in the entity.\n *\n * @param options - Options that allow to specify the cutoff time for deletion. Only messages that were enqueued\n * before this time will be deleted. If not specified, current time will be used.\n * @returns number of messages deleted.\n */\n purgeMessages(options?: PurgeMessagesOptions): Promise<number>;\n\n /**\n * Path of the entity for which the receiver has been created.\n */\n entityPath: string;\n /**\n * The receive mode used to create the receiver.\n */\n receiveMode: \"peekLock\" | \"receiveAndDelete\";\n /**\n * Returns `true` if either the receiver or the client that created it has been closed.\n * @readonly\n */\n isClosed: boolean;\n /**\n * Closes the receiver.\n * Once closed, the receiver cannot be used for any further operations.\n * Use the `createReceiver()` method on the ServiceBusClient to create a new Receiver.\n */\n close(): Promise<void>;\n /**\n * Removes the message from Service Bus.\n *\n * @throws Error with name `SessionLockLostError` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws Error with name `MessageLockLostError` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws Error with name `ServiceUnavailableError` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n */\n completeMessage(message: ServiceBusReceivedMessage): Promise<void>;\n /**\n * The lock held on the message by the receiver is let go, making the message available again in\n * Service Bus for another receive operation.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param propertiesToModify - The properties of the message to modify while abandoning the message.\n */\n abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Defers the processing of the message. Save the `sequenceNumber` of the message, in order to\n * receive it message again in the future using the `receiveDeferredMessage` method.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param propertiesToModify - The properties of the message to modify while deferring the message\n */\n deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Moves the message to the deadletter sub-queue. To receive a deadletted message, create a new\n * QueueClient/SubscriptionClient using the path for the deadletter sub-queue.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param options - The DeadLetter options that can be provided while\n * rejecting the message.\n */\n deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Renews the lock on the message for the duration as specified during the Queue/Subscription\n * creation.\n * - Check the `lockedUntilUtc` property on the message for the time when the lock expires.\n * - If a message is not settled (using either `complete()`, `defer()` or `deadletter()`,\n * before its lock expires, then the message lands back in the Queue/Subscription for the next\n * receive operation.\n *\n * @returns New lock token expiry date and time in UTC format.\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws ServiceBusError if the service returns an error while renewing message lock.\n */\n renewMessageLock(message: ServiceBusReceivedMessage): Promise<Date>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusReceiverImpl implements ServiceBusReceiver {\n public identifier: string;\n private _retryOptions: RetryOptions;\n /**\n * Denotes if close() was called on this receiver\n */\n private _isClosed: boolean = false;\n\n /**\n * Instance of the BatchingReceiver class to use to receive messages in pull mode.\n */\n private _batchingReceiver?: BatchingReceiver;\n\n /**\n * Instance of the StreamingReceiver class to use to receive messages in push mode.\n */\n private _streamingReceiver?: StreamingReceiver;\n private _lockRenewer: LockRenewer | undefined;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|receiver:${this.entityPath}]`;\n }\n\n /**\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n public entityPath: string,\n public receiveMode: \"peekLock\" | \"receiveAndDelete\",\n maxAutoRenewLockDurationInMs: number,\n private skipParsingBodyAsJson: boolean,\n private skipConvertingDate: boolean = false,\n retryOptions: RetryOptions = {},\n identifier?: string,\n ) {\n throwErrorIfConnectionClosed(_context);\n this._retryOptions = retryOptions;\n this._lockRenewer = LockRenewer.create(\n this._context,\n maxAutoRenewLockDurationInMs,\n receiveMode,\n );\n this.identifier = ensureValidIdentifier(this.entityPath, identifier);\n }\n\n private _throwIfAlreadyReceiving(): void {\n if (this._isReceivingMessages()) {\n const errorMessage = getAlreadyReceivingErrorMsg(this.entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is already receiving`);\n throw error;\n }\n }\n\n private _throwIfReceiverOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n const errorMessage = getReceiverClosedErrorMsg(this.entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is closed`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n async receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const receiveMessages = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (!this._batchingReceiver || !this._context.messageReceivers[this._batchingReceiver.name]) {\n const receiveOptions: ReceiveOptions = {\n maxConcurrentCalls: 0,\n receiveMode: this.receiveMode,\n lockRenewer: this._lockRenewer,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n };\n this._batchingReceiver = this._createBatchingReceiver(\n this._context,\n this.entityPath,\n receiveOptions,\n );\n }\n\n const receivedMessages = await this._batchingReceiver.receive(\n maxMessageCount,\n options?.maxWaitTimeInMs ?? Constants.defaultOperationTimeoutInMs,\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n options ?? {},\n );\n\n return receivedMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n connectionHost: this._context.config.host,\n connectionId: this._context.connectionId,\n operation: receiveMessages,\n operationType: RetryOperationType.receiveMessage,\n abortSignal: options?.abortSignal,\n retryOptions: this._retryOptions,\n };\n return retry<ServiceBusReceivedMessage[]>(config).catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage> {\n return getMessageIterator(this, options);\n }\n\n async receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const deferredSequenceNumbers = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const receiveDeferredMessagesOperationPromise = async (): Promise<\n ServiceBusReceivedMessage[]\n > => {\n const deferredMessages = await this._context\n .getManagementClient(this.entityPath)\n .receiveDeferredMessages(deferredSequenceNumbers, this.receiveMode, undefined, {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"receiveDeferredMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n });\n return deferredMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveDeferredMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async deleteMessages(options: DeleteMessagesOptions): Promise<number> {\n this._throwIfReceiverOrConnectionClosed();\n\n const deleteMessagesOperationPromise = (): Promise<number> => {\n return this._context\n .getManagementClient(this.entityPath)\n .deleteMessages(options.maxMessageCount, options?.beforeEnqueueTime, undefined, {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"deleteMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<number> = {\n operation: deleteMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<number>(config);\n }\n\n async purgeMessages(options?: PurgeMessagesOptions): Promise<number> {\n let deletedCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`,\n );\n if (deletedCount > 0) {\n let batchCount = deletedCount;\n while (batchCount > 0) {\n batchCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${batchCount} messages.`,\n );\n deletedCount += batchCount;\n }\n }\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' purged ${deletedCount} messages.`,\n );\n return deletedCount;\n }\n\n // ManagementClient methods # Begin\n\n async peekMessages(\n maxMessageCount: number,\n options: PeekMessagesOptions = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n\n const managementRequestOptions = {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"peekMessages\",\n timeoutInMs: this._retryOptions?.timeoutInMs,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n };\n const peekOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (options.fromSequenceNumber !== undefined) {\n return this._context\n .getManagementClient(this.entityPath)\n .peekBySequenceNumber(\n options.fromSequenceNumber,\n maxMessageCount,\n undefined,\n options.omitMessageBody,\n managementRequestOptions,\n );\n } else {\n return this._context\n .getManagementClient(this.entityPath)\n .peek(maxMessageCount, options.omitMessageBody, managementRequestOptions);\n }\n };\n\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: peekOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n close(): Promise<void>;\n } {\n assertValidMessageHandlers(handlers);\n throwErrorIfConnectionClosed(this._context);\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n\n options = {\n ...(options ?? {}),\n autoCompleteMessages: options?.autoCompleteMessages ?? true,\n };\n\n // When the user \"stops\" a streaming receiver (via the returned instance from 'subscribe' we just suspend\n // it, leaving the link open). This allows users to stop the flow of messages but still be able to settle messages\n // since the link itself hasn't been shut down.\n //\n // Users can, if they want, restart their subscription (since we've got a link already established).\n // So you'll have an instance here if the user has done:\n // 1. const subscription = receiver.subscribe()\n // 2. subscription.stop()\n // 3. receiver.subscribe()\n\n this._streamingReceiver =\n this._streamingReceiver ??\n new StreamingReceiver(this.identifier, this._context, this.entityPath, {\n ...options,\n receiveMode: this.receiveMode,\n retryOptions: this._retryOptions,\n lockRenewer: this._lockRenewer,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n });\n\n // this ensures that if the outer service bus client is closed that this receiver is cleaned up.\n // this mostly affects us if we're in the middle of init() - the connection (and receiver) are not yet\n // open but we do need to close the receiver to exit the init() loop.\n this._context.messageReceivers[this._streamingReceiver.name] = this._streamingReceiver;\n\n this._streamingReceiver.subscribe(handlers, options).catch((_) => {\n // (the error will already have been reported to the user)\n if (this._streamingReceiver) {\n delete this._context.messageReceivers[this._streamingReceiver.name];\n }\n });\n\n return {\n close: async (): Promise<void> => {\n return this._streamingReceiver?.stopReceivingMessages();\n },\n };\n }\n\n async completeMessage(message: ServiceBusReceivedMessage): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return completeMessage(msgImpl, this._context, this.entityPath, this._retryOptions);\n }\n\n async abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return abandonMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deferMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deadLetterMessage(msgImpl, this._context, this.entityPath, options, this._retryOptions);\n }\n\n async renewMessageLock(message: ServiceBusReceivedMessage): Promise<Date> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n\n return tracingClient.withSpan(\n \"ServiceBusReceiver.renewMessageLock\",\n {},\n () => {\n const msgImpl = message as ServiceBusMessageImpl;\n\n let associatedLinkName: string | undefined;\n if (msgImpl.delivery.link) {\n const associatedReceiver = this._context.getReceiverFromCache(msgImpl.delivery.link.name);\n associatedLinkName = associatedReceiver?.name;\n }\n return this._context\n .getManagementClient(this.entityPath)\n .renewLock(message.lockToken!, { associatedLinkName })\n .then((lockedUntil) => {\n message.lockedUntilUtc = lockedUntil;\n return lockedUntil;\n });\n },\n {\n spanLinks,\n ...toSpanOptions(\n { entityPath: this.entityPath, host: this._context.config.host },\n \"receive\",\n \"client\",\n ),\n },\n );\n }\n\n async close(): Promise<void> {\n try {\n this._isClosed = true;\n if (this._context.connection && this._context.connection.isOpen()) {\n // Close the streaming receiver.\n if (this._streamingReceiver) {\n await this._streamingReceiver.close();\n }\n\n // Close the batching receiver.\n if (this._batchingReceiver) {\n await this._batchingReceiver.close();\n }\n }\n } catch (err: any) {\n logger.logError(err, `${this.logPrefix} An error occurred while closing the Receiver`);\n throw err;\n }\n }\n\n /**\n * Indicates whether the receiver is currently receiving messages or not.\n * When this returns true, new `registerMessageHandler()` or `receiveMessages()` calls cannot be made.\n */\n private _isReceivingMessages(): boolean {\n if (\n this._streamingReceiver &&\n this._streamingReceiver.isOpen() &&\n this._streamingReceiver.isSubscribeActive\n ) {\n return true;\n }\n if (\n this._batchingReceiver &&\n this._batchingReceiver.isOpen() &&\n this._batchingReceiver.isReceivingMessages\n ) {\n return true;\n }\n return false;\n }\n\n private _createBatchingReceiver(\n context: ConnectionContext,\n entityPath: string,\n options: ReceiveOptions,\n ): BatchingReceiver {\n const receiver = BatchingReceiver.create(this.identifier, context, entityPath, options);\n logger.verbose(\n `[${this.logPrefix}] receiver '${receiver.name}' created, with maxConcurrentCalls set to ${options.maxConcurrentCalls}.`,\n );\n\n return receiver;\n }\n\n /**\n * Helper function to retrieve any active receiver name, regardless of streaming or\n * batching if it exists. This is used for optimization on the service side\n */\n private _getAssociatedReceiverName(): string | undefined {\n if (this._streamingReceiver && this._streamingReceiver.isOpen()) {\n return this._streamingReceiver.name;\n }\n if (\n this._batchingReceiver &&\n this._batchingReceiver.isOpen() &&\n this._batchingReceiver.isReceivingMessages\n ) {\n return this._batchingReceiver.name;\n }\n return;\n }\n}\n"]}
@@ -269,16 +269,19 @@ export class ServiceBusSessionReceiverImpl {
269
269
  maxMessageCount: MaxDeleteMessageCount,
270
270
  beforeEnqueueTime: options?.beforeEnqueueTime,
271
271
  });
272
- if (deletedCount === MaxDeleteMessageCount) {
273
- let batchCount = MaxDeleteMessageCount;
274
- while (batchCount === MaxDeleteMessageCount) {
272
+ logger.verbose(`${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`);
273
+ if (deletedCount > 0) {
274
+ let batchCount = deletedCount;
275
+ while (batchCount > 0) {
275
276
  batchCount = await this.deleteMessages({
276
277
  maxMessageCount: MaxDeleteMessageCount,
277
278
  beforeEnqueueTime: options?.beforeEnqueueTime,
278
279
  });
280
+ logger.verbose(`${this.logPrefix} receiver '${this.identifier}' deleted ${batchCount} messages.`);
279
281
  deletedCount += batchCount;
280
282
  }
281
283
  }
284
+ logger.verbose(`${this.logPrefix} receiver '${this.identifier}' purged ${deletedCount} messages.`);
282
285
  return deletedCount;
283
286
  }
284
287
  async receiveMessages(maxMessageCount, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"sessionReceiver.js","sourceRoot":"","sources":["../../../src/receivers/sessionReceiver.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,qCAAqC,GACtC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,4CAA4C,EAC5C,qBAAqB,GAEtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,SAAS,EAET,kBAAkB,EAElB,KAAK,EACL,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAkE9D;;GAEG;AACH,MAAM,OAAO,6B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AAa,CACnB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAkC,EAClC,OAAwF;QAExF,IAAI,CAAC,kCAAkC,EAAE,CAAC;QAC1C,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC7F,MAAM,OAAO,GAAG,OAAgC,CAAC;QACjD,OAAO,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACjG,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;IAC/F,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QACrC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,CAAC,QAAQ,CACb,GAAG,EACH,uEAAuE,EACvE,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,SAAS,CACf,CAAC;YACF,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,oBAAoB;QAC1B,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC;IACjF,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ConnectionContext } from \"../connectionContext\";\nimport { MessageHandlers, ReceiveMessagesOptions, ServiceBusReceivedMessage } from \"..\";\nimport {\n PeekMessagesOptions,\n GetMessageIteratorOptions,\n SubscribeOptions,\n DeleteMessagesOptions,\n PurgeMessagesOptions,\n} from \"../models\";\nimport { MessageSession } from \"../session/messageSession\";\nimport {\n getAlreadyReceivingErrorMsg,\n getReceiverClosedErrorMsg,\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwErrorIfInvalidOperationOnMessage,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { OnError, OnMessage } from \"../core/messageReceiver\";\nimport {\n abandonMessage,\n assertValidMessageHandlers,\n completeMessage,\n deadLetterMessage,\n deferMessage,\n getMessageIterator,\n wrapProcessErrorHandler,\n} from \"./receiverCommon\";\nimport {\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n MaxDeleteMessageCount,\n ServiceBusReceiver,\n} from \"./receiver\";\nimport Long from \"long\";\nimport { ServiceBusMessageImpl, DeadLetterOptions } from \"../serviceBusMessage\";\nimport {\n Constants,\n RetryConfig,\n RetryOperationType,\n RetryOptions,\n retry,\n ErrorNameConditionMapper,\n} from \"@azure/core-amqp\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { AmqpError } from \"rhea-promise\";\nimport { toProcessingSpanOptions } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { tracingClient } from \"../diagnostics/tracing\";\nimport { receiverLogger as logger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\n\n/**\n *A receiver that handles sessions, including renewing the session lock.\n */\nexport interface ServiceBusSessionReceiver extends ServiceBusReceiver {\n /**\n * The session ID.\n */\n readonly sessionId: string;\n\n /**\n * The time in UTC until which the session is locked.\n * Every time `renewSessionLock()` is called, this time gets updated to current time plus the lock\n * duration as specified during the Queue/Subscription creation.\n *\n * Will return undefined until a AMQP receiver link has been successfully set up for the session.\n *\n * @readonly\n */\n readonly sessionLockedUntilUtc: Date;\n\n /**\n * Streams messages to message handlers.\n * @param handlers - A handler that gets called for messages and errors.\n * @param options - Options for subscribe.\n * @returns An object that can be closed, sending any remaining messages to `handlers` and\n * stopping new messages from arriving.\n */\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n /**\n * Causes the subscriber to stop receiving new messages.\n */\n close(): Promise<void>;\n };\n\n /**\n * Renews the lock on the session.\n */\n renewSessionLock(options?: OperationOptionsBase): Promise<Date>;\n\n /**\n * Gets the state of the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The state of that session\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while retrieving session state.\n */\n getSessionState(options?: OperationOptionsBase): Promise<any>;\n\n /**\n * Sets the state on the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param state - The state that needs to be set.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while setting the session state.\n *\n */\n setSessionState(state: any, options?: OperationOptionsBase): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusSessionReceiverImpl implements ServiceBusSessionReceiver {\n public sessionId: string;\n public identifier: string;\n\n /**\n * Denotes if close() was called on this receiver\n */\n private _isClosed: boolean = false;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|session:${this.entityPath}]`;\n }\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n * @throws Error if an open receiver is already existing for given sessionId.\n */\n constructor(\n private _messageSession: MessageSession,\n private _context: ConnectionContext,\n public entityPath: string,\n public receiveMode: \"peekLock\" | \"receiveAndDelete\",\n private _skipParsingBodyAsJson: boolean,\n private _skipConvertingDate: boolean,\n private _retryOptions: RetryOptions = {},\n ) {\n throwErrorIfConnectionClosed(_context);\n this.sessionId = _messageSession.sessionId;\n this.identifier = _messageSession.identifier;\n }\n\n private _throwIfReceiverOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n if (this._isClosed) {\n const errorMessage = getReceiverClosedErrorMsg(this.entityPath, this.sessionId);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} already closed`);\n throw error;\n }\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SessionLockLostError,\n description: `The session lock has expired on the session with id ${this.sessionId}`,\n };\n throw translateServiceBusError(amqpError);\n }\n }\n\n private _throwIfAlreadyReceiving(): void {\n if (this._isReceivingMessages()) {\n const errorMessage = getAlreadyReceivingErrorMsg(this.entityPath, this.sessionId);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is already receiving.`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return (\n this._isClosed ||\n !this._context.messageSessions[this._messageSession.name] ||\n !this._messageSession.isOpen()\n );\n }\n\n /**\n * The time in UTC until which the session is locked.\n * Every time `renewSessionLock()` is called, this time gets updated to current time plus the lock\n * duration as specified during the Queue/Subscription creation.\n *\n * When the lock on the session expires\n * - The current receiver can no longer be used to receive more messages.\n * Create a new receiver using `ServiceBusClient.acceptSession()` or `ServiceBusClient.acceptNextSession()`.\n * - Messages that were received in `peekLock` mode with this receiver but not yet settled\n * will land back in the Queue/Subscription with their delivery count incremented.\n *\n * @readonly\n */\n public get sessionLockedUntilUtc(): Date {\n return this._messageSession.sessionLockedUntilUtc;\n }\n\n /**\n * Renews the lock on the session for the duration as specified during the Queue/Subscription\n * creation. You can check the `sessionLockedUntilUtc` property for the time when the lock expires.\n *\n * When the lock on the session expires\n * - The current receiver can no longer be used to receive mode messages.\n * Create a new receiver using `ServiceBusClient.acceptSession()` or `ServiceBusClient.acceptNextSession()`.\n * - Messages that were received in `peekLock` mode with this receiver but not yet settled\n * will land back in the Queue/Subscription with their delivery count incremented.\n *\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns New lock token expiry date and time in UTC format.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while renewing session lock.\n */\n async renewSessionLock(options?: OperationOptionsBase): Promise<Date> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.renewSessionLock\",\n options ?? {},\n (updatedOptions) => {\n const renewSessionLockOperationPromise = async (): Promise<Date> => {\n this._messageSession!.sessionLockedUntilUtc = await this._context\n .getManagementClient(this.entityPath)\n .renewSessionLock(this.sessionId, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"renewSessionLock\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n return this._messageSession!.sessionLockedUntilUtc!;\n };\n const config: RetryConfig<Date> = {\n operation: renewSessionLockOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<Date>(config);\n },\n );\n }\n\n /**\n * Sets the state on the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param state - The state that needs to be set.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while setting the session state.\n */\n async setSessionState(state: unknown, options: OperationOptionsBase = {}): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.setSessionState\",\n options ?? {},\n (updatedOptions) => {\n const setSessionStateOperationPromise = async (): Promise<void> => {\n await this._context\n .getManagementClient(this.entityPath)\n .setSessionState(this.sessionId!, state, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"setState\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n return;\n };\n const config: RetryConfig<void> = {\n operation: setSessionStateOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n\n /**\n * Gets the state of the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The state of that session\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while retrieving session state.\n */\n async getSessionState(options: OperationOptionsBase = {}): Promise<any> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.getSessionState\",\n options ?? {},\n (updatedOptions) => {\n const getSessionStateOperationPromise = async (): Promise<any> => {\n return this._context\n .getManagementClient(this.entityPath)\n .getSessionState(this.sessionId, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"getState\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<any> = {\n operation: getSessionStateOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<any>(config);\n },\n );\n }\n\n async peekMessages(\n maxMessageCount: number,\n options: PeekMessagesOptions = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n\n const managementRequestOptions = {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"peekMessages\",\n timeoutInMs: this._retryOptions?.timeoutInMs,\n skipParsingBodyAsJson: this._skipParsingBodyAsJson,\n skipConvertingDate: this._skipConvertingDate,\n };\n const peekOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (options.fromSequenceNumber !== undefined) {\n return this._context\n .getManagementClient(this.entityPath)\n .peekBySequenceNumber(\n options.fromSequenceNumber,\n maxMessageCount,\n this.sessionId,\n options.omitMessageBody,\n managementRequestOptions,\n );\n } else {\n return this._context\n .getManagementClient(this.entityPath)\n .peekMessagesBySession(\n this.sessionId,\n maxMessageCount,\n options.omitMessageBody,\n managementRequestOptions,\n );\n }\n };\n\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: peekOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const deferredSequenceNumbers = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const receiveDeferredMessagesOperationPromise = async (): Promise<\n ServiceBusReceivedMessage[]\n > => {\n const deferredMessages = await this._context\n .getManagementClient(this.entityPath)\n .receiveDeferredMessages(deferredSequenceNumbers, this.receiveMode, this.sessionId, {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"receiveDeferredMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n skipParsingBodyAsJson: this._skipParsingBodyAsJson,\n skipConvertingDate: this._skipConvertingDate,\n });\n return deferredMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveDeferredMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async deleteMessages(options: DeleteMessagesOptions): Promise<number> {\n this._throwIfReceiverOrConnectionClosed();\n\n const deleteMessagesOperationPromise = (): Promise<number> => {\n return this._context\n .getManagementClient(this.entityPath)\n .deleteMessages(options.maxMessageCount, options?.beforeEnqueueTime, this.sessionId, {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"deleteMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<number> = {\n operation: deleteMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<number>(config);\n }\n\n async purgeMessages(options?: PurgeMessagesOptions): Promise<number> {\n let deletedCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n if (deletedCount === MaxDeleteMessageCount) {\n let batchCount = MaxDeleteMessageCount;\n while (batchCount === MaxDeleteMessageCount) {\n batchCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n deletedCount += batchCount;\n }\n }\n return deletedCount;\n }\n\n async receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const receiveBatchOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n const receivedMessages = await this._messageSession!.receiveMessages(\n maxMessageCount,\n options?.maxWaitTimeInMs ?? Constants.defaultOperationTimeoutInMs,\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n options ?? {},\n );\n\n return receivedMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveBatchOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.receiveMessage,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config).catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n close(): Promise<void>;\n } {\n // TODO - receiverOptions for subscribe??\n assertValidMessageHandlers(handlers);\n\n options = options ?? {};\n\n const processError = wrapProcessErrorHandler(handlers);\n\n this._registerMessageHandler(\n async (message: ServiceBusMessageImpl) => {\n return tracingClient.withSpan(\n \"SessionReceiver.process\",\n options ?? {},\n () => handlers.processMessage(message),\n toProcessingSpanOptions(message, this, this._context.config, \"process\"),\n );\n },\n processError,\n options,\n );\n\n return {\n close: async (): Promise<void> => {\n return this._messageSession?.receiverHelper.suspend();\n },\n };\n }\n\n /**\n * Registers handlers to deal with the incoming stream of messages over an AMQP receiver link\n * from a Queue/Subscription.\n * To stop receiving messages, call `close()` on the SessionReceiver.\n *\n * Throws an error if there is another receive operation in progress on the same receiver. If you\n * are not sure whether there is another receive operation running, check the `isReceivingMessages`\n * property on the receiver.\n *\n * @param onMessage - Handler for processing each incoming message.\n * @param onError - Handler for any error that occurs while receiving or processing messages.\n * @param options - Options to control whether messages should be automatically completed\n * or if the lock on the session should be automatically renewed. You can control the\n * maximum number of messages that should be concurrently processed. You can\n * also provide a timeout in milliseconds to denote the amount of time to wait for a new message\n * before closing the receiver.\n *\n * @throws Error if the underlying connection or receiver is closed.\n * @throws Error if the receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages. These are bubbled up to be handled by user provided `onError` handler.\n */\n private _registerMessageHandler(\n onMessage: OnMessage,\n onError: OnError,\n options: SubscribeOptions,\n ): void {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n const connId = this._context.connectionId;\n throwTypeErrorIfParameterMissing(connId, \"onMessage\", onMessage);\n throwTypeErrorIfParameterMissing(connId, \"onError\", onError);\n if (typeof onMessage !== \"function\") {\n throw new TypeError(\"The parameter 'onMessage' must be of type 'function'.\");\n }\n if (typeof onError !== \"function\") {\n throw new TypeError(\"The parameter 'onError' must be of type 'function'.\");\n }\n\n try {\n this._messageSession.subscribe(onMessage, onError, options);\n } catch (err: any) {\n onError({\n error: err,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n }\n\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage> {\n return getMessageIterator(this, options);\n }\n\n async completeMessage(message: ServiceBusReceivedMessage): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return completeMessage(msgImpl, this._context, this.entityPath, this._retryOptions);\n }\n\n async abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return abandonMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deferMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deadLetterMessage(msgImpl, this._context, this.entityPath, options, this._retryOptions);\n }\n\n async renewMessageLock(): Promise<Date> {\n throw new Error(\"Renewing message lock is an invalid operation when working with sessions.\");\n }\n\n async close(): Promise<void> {\n try {\n await this._messageSession.close();\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while closing the SessionReceiver for session %s\",\n this.logPrefix,\n this.sessionId,\n );\n throw err;\n } finally {\n this._isClosed = true;\n }\n }\n\n /**\n * Indicates whether the receiver is currently receiving messages or not.\n * When this returns true, new `registerMessageHandler()` or `receiveMessages()` calls cannot be made.\n */\n private _isReceivingMessages(): boolean {\n return this._messageSession ? this._messageSession.isReceivingMessages : false;\n }\n}\n"]}
1
+ {"version":3,"file":"sessionReceiver.js","sourceRoot":"","sources":["../../../src/receivers/sessionReceiver.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,qCAAqC,GACtC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,4CAA4C,EAC5C,qBAAqB,GAEtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,SAAS,EAET,kBAAkB,EAElB,KAAK,EACL,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAkE9D;;GAEG;AACH,MAAM,OAAO,6BAA6B;IASxC,IAAY,SAAS;QACnB,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,YAAY,IAAI,CAAC,UAAU,GAAG,CAAC;IACtE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n// Licensed under the MIT license.\n\nimport { ConnectionContext } from \"../connectionContext\";\nimport { MessageHandlers, ReceiveMessagesOptions, ServiceBusReceivedMessage } from \"..\";\nimport {\n PeekMessagesOptions,\n GetMessageIteratorOptions,\n SubscribeOptions,\n DeleteMessagesOptions,\n PurgeMessagesOptions,\n} from \"../models\";\nimport { MessageSession } from \"../session/messageSession\";\nimport {\n getAlreadyReceivingErrorMsg,\n getReceiverClosedErrorMsg,\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwErrorIfInvalidOperationOnMessage,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { OnError, OnMessage } from \"../core/messageReceiver\";\nimport {\n abandonMessage,\n assertValidMessageHandlers,\n completeMessage,\n deadLetterMessage,\n deferMessage,\n getMessageIterator,\n wrapProcessErrorHandler,\n} from \"./receiverCommon\";\nimport {\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n MaxDeleteMessageCount,\n ServiceBusReceiver,\n} from \"./receiver\";\nimport Long from \"long\";\nimport { ServiceBusMessageImpl, DeadLetterOptions } from \"../serviceBusMessage\";\nimport {\n Constants,\n RetryConfig,\n RetryOperationType,\n RetryOptions,\n retry,\n ErrorNameConditionMapper,\n} from \"@azure/core-amqp\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { AmqpError } from \"rhea-promise\";\nimport { toProcessingSpanOptions } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { tracingClient } from \"../diagnostics/tracing\";\nimport { receiverLogger as logger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\n\n/**\n *A receiver that handles sessions, including renewing the session lock.\n */\nexport interface ServiceBusSessionReceiver extends ServiceBusReceiver {\n /**\n * The session ID.\n */\n readonly sessionId: string;\n\n /**\n * The time in UTC until which the session is locked.\n * Every time `renewSessionLock()` is called, this time gets updated to current time plus the lock\n * duration as specified during the Queue/Subscription creation.\n *\n * Will return undefined until a AMQP receiver link has been successfully set up for the session.\n *\n * @readonly\n */\n readonly sessionLockedUntilUtc: Date;\n\n /**\n * Streams messages to message handlers.\n * @param handlers - A handler that gets called for messages and errors.\n * @param options - Options for subscribe.\n * @returns An object that can be closed, sending any remaining messages to `handlers` and\n * stopping new messages from arriving.\n */\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n /**\n * Causes the subscriber to stop receiving new messages.\n */\n close(): Promise<void>;\n };\n\n /**\n * Renews the lock on the session.\n */\n renewSessionLock(options?: OperationOptionsBase): Promise<Date>;\n\n /**\n * Gets the state of the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The state of that session\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while retrieving session state.\n */\n getSessionState(options?: OperationOptionsBase): Promise<any>;\n\n /**\n * Sets the state on the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param state - The state that needs to be set.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while setting the session state.\n *\n */\n setSessionState(state: any, options?: OperationOptionsBase): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusSessionReceiverImpl implements ServiceBusSessionReceiver {\n public sessionId: string;\n public identifier: string;\n\n /**\n * Denotes if close() was called on this receiver\n */\n private _isClosed: boolean = false;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|session:${this.entityPath}]`;\n }\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n * @throws Error if an open receiver is already existing for given sessionId.\n */\n constructor(\n private _messageSession: MessageSession,\n private _context: ConnectionContext,\n public entityPath: string,\n public receiveMode: \"peekLock\" | \"receiveAndDelete\",\n private _skipParsingBodyAsJson: boolean,\n private _skipConvertingDate: boolean,\n private _retryOptions: RetryOptions = {},\n ) {\n throwErrorIfConnectionClosed(_context);\n this.sessionId = _messageSession.sessionId;\n this.identifier = _messageSession.identifier;\n }\n\n private _throwIfReceiverOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n if (this._isClosed) {\n const errorMessage = getReceiverClosedErrorMsg(this.entityPath, this.sessionId);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} already closed`);\n throw error;\n }\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SessionLockLostError,\n description: `The session lock has expired on the session with id ${this.sessionId}`,\n };\n throw translateServiceBusError(amqpError);\n }\n }\n\n private _throwIfAlreadyReceiving(): void {\n if (this._isReceivingMessages()) {\n const errorMessage = getAlreadyReceivingErrorMsg(this.entityPath, this.sessionId);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is already receiving.`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return (\n this._isClosed ||\n !this._context.messageSessions[this._messageSession.name] ||\n !this._messageSession.isOpen()\n );\n }\n\n /**\n * The time in UTC until which the session is locked.\n * Every time `renewSessionLock()` is called, this time gets updated to current time plus the lock\n * duration as specified during the Queue/Subscription creation.\n *\n * When the lock on the session expires\n * - The current receiver can no longer be used to receive more messages.\n * Create a new receiver using `ServiceBusClient.acceptSession()` or `ServiceBusClient.acceptNextSession()`.\n * - Messages that were received in `peekLock` mode with this receiver but not yet settled\n * will land back in the Queue/Subscription with their delivery count incremented.\n *\n * @readonly\n */\n public get sessionLockedUntilUtc(): Date {\n return this._messageSession.sessionLockedUntilUtc;\n }\n\n /**\n * Renews the lock on the session for the duration as specified during the Queue/Subscription\n * creation. You can check the `sessionLockedUntilUtc` property for the time when the lock expires.\n *\n * When the lock on the session expires\n * - The current receiver can no longer be used to receive mode messages.\n * Create a new receiver using `ServiceBusClient.acceptSession()` or `ServiceBusClient.acceptNextSession()`.\n * - Messages that were received in `peekLock` mode with this receiver but not yet settled\n * will land back in the Queue/Subscription with their delivery count incremented.\n *\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns New lock token expiry date and time in UTC format.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while renewing session lock.\n */\n async renewSessionLock(options?: OperationOptionsBase): Promise<Date> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.renewSessionLock\",\n options ?? {},\n (updatedOptions) => {\n const renewSessionLockOperationPromise = async (): Promise<Date> => {\n this._messageSession!.sessionLockedUntilUtc = await this._context\n .getManagementClient(this.entityPath)\n .renewSessionLock(this.sessionId, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"renewSessionLock\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n return this._messageSession!.sessionLockedUntilUtc!;\n };\n const config: RetryConfig<Date> = {\n operation: renewSessionLockOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<Date>(config);\n },\n );\n }\n\n /**\n * Sets the state on the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param state - The state that needs to be set.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while setting the session state.\n */\n async setSessionState(state: unknown, options: OperationOptionsBase = {}): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.setSessionState\",\n options ?? {},\n (updatedOptions) => {\n const setSessionStateOperationPromise = async (): Promise<void> => {\n await this._context\n .getManagementClient(this.entityPath)\n .setSessionState(this.sessionId!, state, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"setState\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n return;\n };\n const config: RetryConfig<void> = {\n operation: setSessionStateOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n\n /**\n * Gets the state of the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The state of that session\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while retrieving session state.\n */\n async getSessionState(options: OperationOptionsBase = {}): Promise<any> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.getSessionState\",\n options ?? {},\n (updatedOptions) => {\n const getSessionStateOperationPromise = async (): Promise<any> => {\n return this._context\n .getManagementClient(this.entityPath)\n .getSessionState(this.sessionId, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"getState\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<any> = {\n operation: getSessionStateOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<any>(config);\n },\n );\n }\n\n async peekMessages(\n maxMessageCount: number,\n options: PeekMessagesOptions = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n\n const managementRequestOptions = {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"peekMessages\",\n timeoutInMs: this._retryOptions?.timeoutInMs,\n skipParsingBodyAsJson: this._skipParsingBodyAsJson,\n skipConvertingDate: this._skipConvertingDate,\n };\n const peekOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (options.fromSequenceNumber !== undefined) {\n return this._context\n .getManagementClient(this.entityPath)\n .peekBySequenceNumber(\n options.fromSequenceNumber,\n maxMessageCount,\n this.sessionId,\n options.omitMessageBody,\n managementRequestOptions,\n );\n } else {\n return this._context\n .getManagementClient(this.entityPath)\n .peekMessagesBySession(\n this.sessionId,\n maxMessageCount,\n options.omitMessageBody,\n managementRequestOptions,\n );\n }\n };\n\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: peekOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const deferredSequenceNumbers = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const receiveDeferredMessagesOperationPromise = async (): Promise<\n ServiceBusReceivedMessage[]\n > => {\n const deferredMessages = await this._context\n .getManagementClient(this.entityPath)\n .receiveDeferredMessages(deferredSequenceNumbers, this.receiveMode, this.sessionId, {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"receiveDeferredMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n skipParsingBodyAsJson: this._skipParsingBodyAsJson,\n skipConvertingDate: this._skipConvertingDate,\n });\n return deferredMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveDeferredMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async deleteMessages(options: DeleteMessagesOptions): Promise<number> {\n this._throwIfReceiverOrConnectionClosed();\n\n const deleteMessagesOperationPromise = (): Promise<number> => {\n return this._context\n .getManagementClient(this.entityPath)\n .deleteMessages(options.maxMessageCount, options?.beforeEnqueueTime, this.sessionId, {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"deleteMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<number> = {\n operation: deleteMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<number>(config);\n }\n\n async purgeMessages(options?: PurgeMessagesOptions): Promise<number> {\n let deletedCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`,\n );\n if (deletedCount > 0) {\n let batchCount = deletedCount;\n while (batchCount > 0) {\n batchCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${batchCount} messages.`,\n );\n deletedCount += batchCount;\n }\n }\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' purged ${deletedCount} messages.`,\n );\n return deletedCount;\n }\n\n async receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const receiveBatchOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n const receivedMessages = await this._messageSession!.receiveMessages(\n maxMessageCount,\n options?.maxWaitTimeInMs ?? Constants.defaultOperationTimeoutInMs,\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n options ?? {},\n );\n\n return receivedMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveBatchOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.receiveMessage,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config).catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n close(): Promise<void>;\n } {\n // TODO - receiverOptions for subscribe??\n assertValidMessageHandlers(handlers);\n\n options = options ?? {};\n\n const processError = wrapProcessErrorHandler(handlers);\n\n this._registerMessageHandler(\n async (message: ServiceBusMessageImpl) => {\n return tracingClient.withSpan(\n \"SessionReceiver.process\",\n options ?? {},\n () => handlers.processMessage(message),\n toProcessingSpanOptions(message, this, this._context.config, \"process\"),\n );\n },\n processError,\n options,\n );\n\n return {\n close: async (): Promise<void> => {\n return this._messageSession?.receiverHelper.suspend();\n },\n };\n }\n\n /**\n * Registers handlers to deal with the incoming stream of messages over an AMQP receiver link\n * from a Queue/Subscription.\n * To stop receiving messages, call `close()` on the SessionReceiver.\n *\n * Throws an error if there is another receive operation in progress on the same receiver. If you\n * are not sure whether there is another receive operation running, check the `isReceivingMessages`\n * property on the receiver.\n *\n * @param onMessage - Handler for processing each incoming message.\n * @param onError - Handler for any error that occurs while receiving or processing messages.\n * @param options - Options to control whether messages should be automatically completed\n * or if the lock on the session should be automatically renewed. You can control the\n * maximum number of messages that should be concurrently processed. You can\n * also provide a timeout in milliseconds to denote the amount of time to wait for a new message\n * before closing the receiver.\n *\n * @throws Error if the underlying connection or receiver is closed.\n * @throws Error if the receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages. These are bubbled up to be handled by user provided `onError` handler.\n */\n private _registerMessageHandler(\n onMessage: OnMessage,\n onError: OnError,\n options: SubscribeOptions,\n ): void {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n const connId = this._context.connectionId;\n throwTypeErrorIfParameterMissing(connId, \"onMessage\", onMessage);\n throwTypeErrorIfParameterMissing(connId, \"onError\", onError);\n if (typeof onMessage !== \"function\") {\n throw new TypeError(\"The parameter 'onMessage' must be of type 'function'.\");\n }\n if (typeof onError !== \"function\") {\n throw new TypeError(\"The parameter 'onError' must be of type 'function'.\");\n }\n\n try {\n this._messageSession.subscribe(onMessage, onError, options);\n } catch (err: any) {\n onError({\n error: err,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n }\n\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage> {\n return getMessageIterator(this, options);\n }\n\n async completeMessage(message: ServiceBusReceivedMessage): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return completeMessage(msgImpl, this._context, this.entityPath, this._retryOptions);\n }\n\n async abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return abandonMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deferMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deadLetterMessage(msgImpl, this._context, this.entityPath, options, this._retryOptions);\n }\n\n async renewMessageLock(): Promise<Date> {\n throw new Error(\"Renewing message lock is an invalid operation when working with sessions.\");\n }\n\n async close(): Promise<void> {\n try {\n await this._messageSession.close();\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while closing the SessionReceiver for session %s\",\n this.logPrefix,\n this.sessionId,\n );\n throw err;\n } finally {\n this._isClosed = true;\n }\n }\n\n /**\n * Indicates whether the receiver is currently receiving messages or not.\n * When this returns true, new `registerMessageHandler()` or `receiveMessages()` calls cannot be made.\n */\n private _isReceivingMessages(): boolean {\n return this._messageSession ? this._messageSession.isReceivingMessages : false;\n }\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export const packageJsonInfo = {
7
7
  name: "@azure/service-bus",
8
- version: "7.10.0",
8
+ version: "7.10.0-beta.1",
9
9
  };
10
10
  /**
11
11
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/util/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,QAAQ;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC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E,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,4BAA4B;IACjC,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,yBAAyB;CAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport const packageJsonInfo = {\n name: \"@azure/service-bus\",\n version: \"7.10.0\",\n};\n\n/**\n * @internal\n */\nexport const messageDispositionTimeout = 20000;\n\n/**\n * The amount of time in milliseconds that a receiver\n * will wait while draining credits before returning.\n * @internal\n */\nexport const receiveDrainTimeoutInMs = 200;\n\n/**\n * @internal\n */\nexport const max32BitNumber = Math.pow(2, 31) - 1;\n\n/**\n * Queue name identifier\n * @internal\n */\nexport const QUEUE_NAME = \"QueueName\";\n\n/**\n * Topic name identifier\n * @internal\n */\nexport const TOPIC_NAME = \"TopicName\";\n\n/**\n * Subscription name identifier\n * @internal\n */\nexport const SUBSCRIPTION_NAME = \"SubscriptionName\";\n\n/**\n * Rule name identifier\n * @internal\n */\nexport const RULE_NAME = \"RuleName\";\n\n/**\n * Accessed at field\n * @internal\n */\nexport const ACCESSED_AT = \"AccessedAt\";\n\n/**\n * Updated at field\n * @internal\n */\nexport const UPDATED_AT = \"UpdatedAt\";\n\n/**\n * Created at field\n * @internal\n */\nexport const CREATED_AT = \"CreatedAt\";\n\n/**\n * Authorization rules on the entity\n * @internal\n */\nexport const AUTHORIZATION_RULES = \"AuthorizationRules\";\n\n/**\n * Is Anonymous Accessible field\n * @internal\n */\nexport const IS_ANONYMOUS_ACCESSIBLE = \"IsAnonymousAccessible\";\n\n/**\n * Entity Availability Status field\n * @internal\n */\nexport const ENTITY_AVAILABILITY_STATUS = \"EntityAvailabilityStatus\";\n\n/**\n * Enable express option\n * @internal\n */\nexport const ENABLE_EXPRESS = \"EnableExpress\";\n\n/**\n * Is express option\n * @internal\n */\nexport const IS_EXPRESS = \"IsExpress\";\n\n/**\n * Enable Subscription Partitioning option\n * @internal\n */\nexport const ENABLE_SUBSCRIPTION_PARTITIONING = \"EnableSubscriptionPartitioning\";\n\n/**\n * Filtering Messages Before Publishing option\n * @internal\n */\nexport const FILTER_MESSAGES_BEFORE_PUBLISHING = \"FilteringMessagesBeforePublishing\";\n\n/**\n * The entity's size in bytes.\n *\n * @internal\n */\nexport const SIZE_IN_BYTES = \"SizeInBytes\";\n\n/**\n * The entity's message count.\n *\n * @internal\n */\nexport const MESSAGE_COUNT = \"MessageCount\";\n\n/**\n * The topic's subscription count.\n *\n * @internal\n */\nexport const SUBSCRIPTION_COUNT = \"SubscriptionCount\";\n\n/**\n * The topic / subscription's count details.\n *\n * @internal\n */\nexport const COUNT_DETAILS = \"CountDetails\";\n\n/**\n * The default rule name.\n *\n * @internal\n */\nexport const DEFAULT_RULE_NAME = \"$Default\";\n\n/**\n * Max idle time before entity is deleted.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const AUTO_DELETE_ON_IDLE = \"AutoDeleteOnIdle\";\n\n/**\n * The status information on response\n *\n * @internal\n */\nexport const STATUS = \"Status\";\n\n/**\n * The URL of Service Bus entity to forward messages to.\n *\n * @internal\n */\nexport const FORWARD_TO = \"ForwardTo\";\n\n/**\n * The user meta data information\n *\n * @internal\n */\nexport const USER_METADATA = \"UserMetadata\";\n\n/**\n * The maximum size in megabytes.\n *\n * @internal\n */\nexport const MAX_SIZE_IN_MEGABYTES = \"MaxSizeInMegabytes\";\n/**\n * The maximum size in kilobytes.\n *\n * @internal\n */\nexport const MAX_MESSAGE_SIZE_IN_KILOBYTES = \"MaxMessageSizeInKilobytes\";\n/**\n * The default message time to live.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DEFAULT_MESSAGE_TIME_TO_LIVE = \"DefaultMessageTimeToLive\";\n\n/**\n * The lock duration.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const LOCK_DURATION = \"LockDuration\";\n\n/**\n * The indication if session is required or not.\n *\n * @internal\n */\nexport const REQUIRES_SESSION = \"RequiresSession\";\n\n/**\n * The indication if duplicate detection is required or not.\n *\n * @internal\n */\nexport const REQUIRES_DUPLICATE_DETECTION = \"RequiresDuplicateDetection\";\n\n/**\n * The indication if dead lettering on message expiration. If it is enabled and a message expires,\n * the Service Bus moves the message from the queue into the entity dead-letter sub-queue.\n * If disabled, message will be permanently deleted from the main entity.\n * Settable only at entity creation time.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_MESSAGE_EXPIRATION = \"DeadLetteringOnMessageExpiration\";\n\n/**\n * The indication if dead lettering on filter evaluation exceptions.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS =\n \"DeadLetteringOnFilterEvaluationExceptions\";\n\n/**\n * The history time window for duplicate detection.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DUPLICATE_DETECTION_HISTORY_TIME_WINDOW = \"DuplicateDetectionHistoryTimeWindow\";\n\n/**\n * The maximum delivery count of messages after which if it is still not settled, gets moved to the dead-letter sub-queue.\n *\n * @internal\n */\nexport const MAX_DELIVERY_COUNT = \"MaxDeliveryCount\";\n\n/**\n * Indicates if the queue has enabled batch operations.\n *\n * @internal\n */\nexport const ENABLE_BATCHED_OPERATIONS = \"EnableBatchedOperations\";\n\n/**\n * Indicates whether the topic can be ordered\n *\n * @internal\n */\nexport const SUPPORT_ORDERING = \"SupportOrdering\";\n\n/**\n * Indicates whether the topic/queue should be split across multiple partitions\n *\n * @internal\n */\nexport const ENABLE_PARTITIONING = \"EnablePartitioning\";\n\n/**\n * The URL of Service Bus entity to forward deadlettered messages to.\n *\n * @internal\n */\nexport const FORWARD_DEADLETTERED_MESSAGES_TO = \"ForwardDeadLetteredMessagesTo\";\n\n/**\n * Query string parameter to set Service Bus API version\n *\n * @internal\n */\nexport const API_VERSION_QUERY_KEY = \"api-version\";\n\n/**\n * Current API version being sent to service bus\n *\n * @internal\n */\nexport const CURRENT_API_VERSION = \"2021-05\";\n\n/**\n * Constant representing the Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE = \"message\";\n/**\n * Constant representing the 'value' property of Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE_VALUE = \"value\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * Constant representing the property where the atom default elements are stored.\n *\n * @internal\n */\nexport const ATOM_METADATA_MARKER = \"_\";\n\n/**\n * Known HTTP status codes as documented and referenced in ATOM based management API feature\n * https://docs.microsoft.com/dotnet/api/system.net.httpstatuscode?view=netframework-4.8\n * @internal\n */\nexport const HttpResponseCodes = {\n 100: \"Continue\",\n 101: \"SwitchingProtocols\",\n 200: \"Ok\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"NonAuthoritativeInformation\",\n 204: \"NoContent\",\n 205: \"ResetContent\",\n 206: \"PartialContent\",\n 300: \"MultipleChoices\",\n 301: \"Moved\",\n 302: \"Redirect\",\n 303: \"RedirectMethod\",\n 304: \"NotModified\",\n 305: \"UseProxy\",\n 306: \"Unused\",\n 400: \"BadRequest\",\n 401: \"Unauthorized\",\n 402: \"PaymentRequired\",\n 403: \"Forbidden\",\n 404: \"NotFound\",\n 405: \"MethodNotAllowed\",\n 406: \"NotAcceptable\",\n 407: \"ProxyAuthenticationRequired\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"LengthRequired\",\n 412: \"PreconditionFailed\",\n 413: \"RequestEntityTooLarge\",\n 414: \"RequestUriTooLong\",\n 415: \"UnsupportedMediaType\",\n 416: \"RequestRangeNotSatisfiable\",\n 417: \"ExpectationFailed\",\n 426: \"UpgradeRequired\",\n 500: \"InternalServerError\",\n 501: \"NotImplemented\",\n 502: \"BadGateway\",\n 503: \"ServiceUnavailable\",\n 504: \"GatewayTimeout\",\n 505: \"HttpVersionNotSupported\",\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/util/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,eAAe;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;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ExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,4BAA4B;IACjC,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,yBAAyB;CAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport const packageJsonInfo = {\n name: \"@azure/service-bus\",\n version: \"7.10.0-beta.1\",\n};\n\n/**\n * @internal\n */\nexport const messageDispositionTimeout = 20000;\n\n/**\n * The amount of time in milliseconds that a receiver\n * will wait while draining credits before returning.\n * @internal\n */\nexport const receiveDrainTimeoutInMs = 200;\n\n/**\n * @internal\n */\nexport const max32BitNumber = Math.pow(2, 31) - 1;\n\n/**\n * Queue name identifier\n * @internal\n */\nexport const QUEUE_NAME = \"QueueName\";\n\n/**\n * Topic name identifier\n * @internal\n */\nexport const TOPIC_NAME = \"TopicName\";\n\n/**\n * Subscription name identifier\n * @internal\n */\nexport const SUBSCRIPTION_NAME = \"SubscriptionName\";\n\n/**\n * Rule name identifier\n * @internal\n */\nexport const RULE_NAME = \"RuleName\";\n\n/**\n * Accessed at field\n * @internal\n */\nexport const ACCESSED_AT = \"AccessedAt\";\n\n/**\n * Updated at field\n * @internal\n */\nexport const UPDATED_AT = \"UpdatedAt\";\n\n/**\n * Created at field\n * @internal\n */\nexport const CREATED_AT = \"CreatedAt\";\n\n/**\n * Authorization rules on the entity\n * @internal\n */\nexport const AUTHORIZATION_RULES = \"AuthorizationRules\";\n\n/**\n * Is Anonymous Accessible field\n * @internal\n */\nexport const IS_ANONYMOUS_ACCESSIBLE = \"IsAnonymousAccessible\";\n\n/**\n * Entity Availability Status field\n * @internal\n */\nexport const ENTITY_AVAILABILITY_STATUS = \"EntityAvailabilityStatus\";\n\n/**\n * Enable express option\n * @internal\n */\nexport const ENABLE_EXPRESS = \"EnableExpress\";\n\n/**\n * Is express option\n * @internal\n */\nexport const IS_EXPRESS = \"IsExpress\";\n\n/**\n * Enable Subscription Partitioning option\n * @internal\n */\nexport const ENABLE_SUBSCRIPTION_PARTITIONING = \"EnableSubscriptionPartitioning\";\n\n/**\n * Filtering Messages Before Publishing option\n * @internal\n */\nexport const FILTER_MESSAGES_BEFORE_PUBLISHING = \"FilteringMessagesBeforePublishing\";\n\n/**\n * The entity's size in bytes.\n *\n * @internal\n */\nexport const SIZE_IN_BYTES = \"SizeInBytes\";\n\n/**\n * The entity's message count.\n *\n * @internal\n */\nexport const MESSAGE_COUNT = \"MessageCount\";\n\n/**\n * The topic's subscription count.\n *\n * @internal\n */\nexport const SUBSCRIPTION_COUNT = \"SubscriptionCount\";\n\n/**\n * The topic / subscription's count details.\n *\n * @internal\n */\nexport const COUNT_DETAILS = \"CountDetails\";\n\n/**\n * The default rule name.\n *\n * @internal\n */\nexport const DEFAULT_RULE_NAME = \"$Default\";\n\n/**\n * Max idle time before entity is deleted.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const AUTO_DELETE_ON_IDLE = \"AutoDeleteOnIdle\";\n\n/**\n * The status information on response\n *\n * @internal\n */\nexport const STATUS = \"Status\";\n\n/**\n * The URL of Service Bus entity to forward messages to.\n *\n * @internal\n */\nexport const FORWARD_TO = \"ForwardTo\";\n\n/**\n * The user meta data information\n *\n * @internal\n */\nexport const USER_METADATA = \"UserMetadata\";\n\n/**\n * The maximum size in megabytes.\n *\n * @internal\n */\nexport const MAX_SIZE_IN_MEGABYTES = \"MaxSizeInMegabytes\";\n/**\n * The maximum size in kilobytes.\n *\n * @internal\n */\nexport const MAX_MESSAGE_SIZE_IN_KILOBYTES = \"MaxMessageSizeInKilobytes\";\n/**\n * The default message time to live.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DEFAULT_MESSAGE_TIME_TO_LIVE = \"DefaultMessageTimeToLive\";\n\n/**\n * The lock duration.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const LOCK_DURATION = \"LockDuration\";\n\n/**\n * The indication if session is required or not.\n *\n * @internal\n */\nexport const REQUIRES_SESSION = \"RequiresSession\";\n\n/**\n * The indication if duplicate detection is required or not.\n *\n * @internal\n */\nexport const REQUIRES_DUPLICATE_DETECTION = \"RequiresDuplicateDetection\";\n\n/**\n * The indication if dead lettering on message expiration. If it is enabled and a message expires,\n * the Service Bus moves the message from the queue into the entity dead-letter sub-queue.\n * If disabled, message will be permanently deleted from the main entity.\n * Settable only at entity creation time.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_MESSAGE_EXPIRATION = \"DeadLetteringOnMessageExpiration\";\n\n/**\n * The indication if dead lettering on filter evaluation exceptions.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS =\n \"DeadLetteringOnFilterEvaluationExceptions\";\n\n/**\n * The history time window for duplicate detection.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DUPLICATE_DETECTION_HISTORY_TIME_WINDOW = \"DuplicateDetectionHistoryTimeWindow\";\n\n/**\n * The maximum delivery count of messages after which if it is still not settled, gets moved to the dead-letter sub-queue.\n *\n * @internal\n */\nexport const MAX_DELIVERY_COUNT = \"MaxDeliveryCount\";\n\n/**\n * Indicates if the queue has enabled batch operations.\n *\n * @internal\n */\nexport const ENABLE_BATCHED_OPERATIONS = \"EnableBatchedOperations\";\n\n/**\n * Indicates whether the topic can be ordered\n *\n * @internal\n */\nexport const SUPPORT_ORDERING = \"SupportOrdering\";\n\n/**\n * Indicates whether the topic/queue should be split across multiple partitions\n *\n * @internal\n */\nexport const ENABLE_PARTITIONING = \"EnablePartitioning\";\n\n/**\n * The URL of Service Bus entity to forward deadlettered messages to.\n *\n * @internal\n */\nexport const FORWARD_DEADLETTERED_MESSAGES_TO = \"ForwardDeadLetteredMessagesTo\";\n\n/**\n * Query string parameter to set Service Bus API version\n *\n * @internal\n */\nexport const API_VERSION_QUERY_KEY = \"api-version\";\n\n/**\n * Current API version being sent to service bus\n *\n * @internal\n */\nexport const CURRENT_API_VERSION = \"2021-05\";\n\n/**\n * Constant representing the Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE = \"message\";\n/**\n * Constant representing the 'value' property of Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE_VALUE = \"value\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * Constant representing the property where the atom default elements are stored.\n *\n * @internal\n */\nexport const ATOM_METADATA_MARKER = \"_\";\n\n/**\n * Known HTTP status codes as documented and referenced in ATOM based management API feature\n * https://docs.microsoft.com/dotnet/api/system.net.httpstatuscode?view=netframework-4.8\n * @internal\n */\nexport const HttpResponseCodes = {\n 100: \"Continue\",\n 101: \"SwitchingProtocols\",\n 200: \"Ok\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"NonAuthoritativeInformation\",\n 204: \"NoContent\",\n 205: \"ResetContent\",\n 206: \"PartialContent\",\n 300: \"MultipleChoices\",\n 301: \"Moved\",\n 302: \"Redirect\",\n 303: \"RedirectMethod\",\n 304: \"NotModified\",\n 305: \"UseProxy\",\n 306: \"Unused\",\n 400: \"BadRequest\",\n 401: \"Unauthorized\",\n 402: \"PaymentRequired\",\n 403: \"Forbidden\",\n 404: \"NotFound\",\n 405: \"MethodNotAllowed\",\n 406: \"NotAcceptable\",\n 407: \"ProxyAuthenticationRequired\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"LengthRequired\",\n 412: \"PreconditionFailed\",\n 413: \"RequestEntityTooLarge\",\n 414: \"RequestUriTooLong\",\n 415: \"UnsupportedMediaType\",\n 416: \"RequestRangeNotSatisfiable\",\n 417: \"ExpectationFailed\",\n 426: \"UpgradeRequired\",\n 500: \"InternalServerError\",\n 501: \"NotImplemented\",\n 502: \"BadGateway\",\n 503: \"ServiceUnavailable\",\n 504: \"GatewayTimeout\",\n 505: \"HttpVersionNotSupported\",\n};\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@azure/service-bus",
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
- "version": "7.10.0-alpha.20240507.1",
5
+ "version": "7.10.0-beta.1",
6
6
  "license": "MIT",
7
7
  "description": "Azure Service Bus SDK for JavaScript",
8
8
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus/",
@@ -29,14 +29,14 @@
29
29
  "./dist/index.js": "dist-esm/src/index.js",
30
30
  "./dist-esm/src/util/runtimeInfo.js": "./dist-esm/src/util/runtimeInfo.native.js"
31
31
  },
32
- "types": "./types/latest/service-bus.d.ts",
32
+ "types": "./types/latest/service-bus-beta.d.ts",
33
33
  "engines": {
34
34
  "node": ">=18.0.0"
35
35
  },
36
36
  "files": [
37
37
  "dist/",
38
38
  "dist-esm/src/",
39
- "types/latest/service-bus.d.ts",
39
+ "types/latest/service-bus-beta.d.ts",
40
40
  "README.md",
41
41
  "LICENSE"
42
42
  ],
@@ -121,8 +121,8 @@
121
121
  "rhea-promise": "^3.0.0"
122
122
  },
123
123
  "devDependencies": {
124
- "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
125
- "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
124
+ "@azure/dev-tool": "^1.0.0",
125
+ "@azure/eslint-plugin-azure-sdk": "^3.0.0",
126
126
  "@azure/identity": "^4.0.1",
127
127
  "@azure-tools/test-utils": "^1.0.0",
128
128
  "@azure-tools/test-perf": "^1.0.0",
@@ -684,7 +684,11 @@ export declare interface PeekMessagesOptions extends OperationOptionsBase {
684
684
  * The sequence number to start peeking messages from (inclusive).
685
685
  */
686
686
  fromSequenceNumber?: Long;
687
- /* Excluded from this release type: omitMessageBody */
687
+ /**
688
+ * @beta
689
+ * (Experimental for diagnostic purpose) Specifies whether to omit the body when peeking messages. Default value `false`.
690
+ */
691
+ omitMessageBody?: boolean;
688
692
  }
689
693
 
690
694
  /**