@azure/event-hubs 6.0.2-alpha.20251015.1 → 6.0.2-alpha.20251021.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.
- package/dist/browser/batchingPartitionChannel.d.ts.map +1 -1
- package/dist/browser/batchingPartitionChannel.js +2 -1
- package/dist/browser/batchingPartitionChannel.js.map +1 -1
- package/dist/browser/connectionContext.d.ts.map +1 -1
- package/dist/browser/connectionContext.js +10 -4
- package/dist/browser/connectionContext.js.map +1 -1
- package/dist/browser/eventHubBufferedProducerClient.d.ts.map +1 -1
- package/dist/browser/eventHubBufferedProducerClient.js +2 -1
- package/dist/browser/eventHubBufferedProducerClient.js.map +1 -1
- package/dist/browser/eventHubConsumerClient.d.ts.map +1 -1
- package/dist/browser/eventHubConsumerClient.js +3 -6
- package/dist/browser/eventHubConsumerClient.js.map +1 -1
- package/dist/browser/eventHubProducerClient.d.ts.map +1 -1
- package/dist/browser/eventHubProducerClient.js +3 -6
- package/dist/browser/eventHubProducerClient.js.map +1 -1
- package/dist/browser/eventHubSender.d.ts.map +1 -1
- package/dist/browser/eventHubSender.js +6 -4
- package/dist/browser/eventHubSender.js.map +1 -1
- package/dist/browser/partitionReceiver.js +4 -4
- package/dist/browser/partitionReceiver.js.map +1 -1
- package/dist/browser/util/timerLoop.d.ts.map +1 -1
- package/dist/browser/util/timerLoop.js +12 -5
- package/dist/browser/util/timerLoop.js.map +1 -1
- package/dist/commonjs/batchingPartitionChannel.d.ts.map +1 -1
- package/dist/commonjs/batchingPartitionChannel.js +2 -1
- package/dist/commonjs/batchingPartitionChannel.js.map +1 -1
- package/dist/commonjs/connectionContext.d.ts.map +1 -1
- package/dist/commonjs/connectionContext.js +10 -4
- package/dist/commonjs/connectionContext.js.map +1 -1
- package/dist/commonjs/eventHubBufferedProducerClient.d.ts.map +1 -1
- package/dist/commonjs/eventHubBufferedProducerClient.js +2 -1
- package/dist/commonjs/eventHubBufferedProducerClient.js.map +1 -1
- package/dist/commonjs/eventHubConsumerClient.d.ts.map +1 -1
- package/dist/commonjs/eventHubConsumerClient.js +3 -6
- package/dist/commonjs/eventHubConsumerClient.js.map +1 -1
- package/dist/commonjs/eventHubProducerClient.d.ts.map +1 -1
- package/dist/commonjs/eventHubProducerClient.js +3 -6
- package/dist/commonjs/eventHubProducerClient.js.map +1 -1
- package/dist/commonjs/eventHubSender.d.ts.map +1 -1
- package/dist/commonjs/eventHubSender.js +6 -4
- package/dist/commonjs/eventHubSender.js.map +1 -1
- package/dist/commonjs/partitionReceiver.js +4 -4
- package/dist/commonjs/partitionReceiver.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/util/timerLoop.d.ts.map +1 -1
- package/dist/commonjs/util/timerLoop.js +12 -5
- package/dist/commonjs/util/timerLoop.js.map +1 -1
- package/dist/esm/batchingPartitionChannel.d.ts.map +1 -1
- package/dist/esm/batchingPartitionChannel.js +2 -1
- package/dist/esm/batchingPartitionChannel.js.map +1 -1
- package/dist/esm/connectionContext.d.ts.map +1 -1
- package/dist/esm/connectionContext.js +10 -4
- package/dist/esm/connectionContext.js.map +1 -1
- package/dist/esm/eventHubBufferedProducerClient.d.ts.map +1 -1
- package/dist/esm/eventHubBufferedProducerClient.js +2 -1
- package/dist/esm/eventHubBufferedProducerClient.js.map +1 -1
- package/dist/esm/eventHubConsumerClient.d.ts.map +1 -1
- package/dist/esm/eventHubConsumerClient.js +3 -6
- package/dist/esm/eventHubConsumerClient.js.map +1 -1
- package/dist/esm/eventHubProducerClient.d.ts.map +1 -1
- package/dist/esm/eventHubProducerClient.js +3 -6
- package/dist/esm/eventHubProducerClient.js.map +1 -1
- package/dist/esm/eventHubSender.d.ts.map +1 -1
- package/dist/esm/eventHubSender.js +6 -4
- package/dist/esm/eventHubSender.js.map +1 -1
- package/dist/esm/partitionReceiver.js +4 -4
- package/dist/esm/partitionReceiver.js.map +1 -1
- package/dist/esm/util/timerLoop.d.ts.map +1 -1
- package/dist/esm/util/timerLoop.js +12 -5
- package/dist/esm/util/timerLoop.js.map +1 -1
- package/dist/react-native/batchingPartitionChannel.d.ts +94 -0
- package/dist/react-native/batchingPartitionChannel.d.ts.map +1 -0
- package/dist/react-native/batchingPartitionChannel.js +255 -0
- package/dist/react-native/batchingPartitionChannel.js.map +1 -0
- package/dist/react-native/connectionContext.d.ts +108 -0
- package/dist/react-native/connectionContext.d.ts.map +1 -0
- package/dist/react-native/connectionContext.js +310 -0
- package/dist/react-native/connectionContext.js.map +1 -0
- package/dist/react-native/dataTransformer.d.ts +53 -0
- package/dist/react-native/dataTransformer.d.ts.map +1 -0
- package/dist/react-native/dataTransformer.js +133 -0
- package/dist/react-native/dataTransformer.js.map +1 -0
- package/dist/react-native/diagnostics/instrumentEventData.d.ts +28 -0
- package/dist/react-native/diagnostics/instrumentEventData.d.ts.map +1 -0
- package/dist/react-native/diagnostics/instrumentEventData.js +67 -0
- package/dist/react-native/diagnostics/instrumentEventData.js.map +1 -0
- package/dist/react-native/diagnostics/tracing.d.ts +19 -0
- package/dist/react-native/diagnostics/tracing.d.ts.map +1 -0
- package/dist/react-native/diagnostics/tracing.js +40 -0
- package/dist/react-native/diagnostics/tracing.js.map +1 -0
- package/dist/react-native/eventData.d.ts +295 -0
- package/dist/react-native/eventData.d.ts.map +1 -0
- package/dist/react-native/eventData.js +247 -0
- package/dist/react-native/eventData.js.map +1 -0
- package/dist/react-native/eventDataAdapter.d.ts +69 -0
- package/dist/react-native/eventDataAdapter.d.ts.map +1 -0
- package/dist/react-native/eventDataAdapter.js +38 -0
- package/dist/react-native/eventDataAdapter.js.map +1 -0
- package/dist/react-native/eventDataBatch.d.ts +225 -0
- package/dist/react-native/eventDataBatch.d.ts.map +1 -0
- package/dist/react-native/eventDataBatch.js +301 -0
- package/dist/react-native/eventDataBatch.js.map +1 -0
- package/dist/react-native/eventHubBufferedProducerClient.d.ts +323 -0
- package/dist/react-native/eventHubBufferedProducerClient.d.ts.map +1 -0
- package/dist/react-native/eventHubBufferedProducerClient.js +301 -0
- package/dist/react-native/eventHubBufferedProducerClient.js.map +1 -0
- package/dist/react-native/eventHubConsumerClient.d.ts +293 -0
- package/dist/react-native/eventHubConsumerClient.d.ts.map +1 -0
- package/dist/react-native/eventHubConsumerClient.js +336 -0
- package/dist/react-native/eventHubConsumerClient.js.map +1 -0
- package/dist/react-native/eventHubConsumerClientModels.d.ts +218 -0
- package/dist/react-native/eventHubConsumerClientModels.d.ts.map +1 -0
- package/dist/react-native/eventHubConsumerClientModels.js +4 -0
- package/dist/react-native/eventHubConsumerClientModels.js.map +1 -0
- package/dist/react-native/eventHubProducerClient.d.ts +299 -0
- package/dist/react-native/eventHubProducerClient.d.ts.map +1 -0
- package/dist/react-native/eventHubProducerClient.js +366 -0
- package/dist/react-native/eventHubProducerClient.js.map +1 -0
- package/dist/react-native/eventHubSender.d.ts +227 -0
- package/dist/react-native/eventHubSender.d.ts.map +1 -0
- package/dist/react-native/eventHubSender.js +626 -0
- package/dist/react-native/eventHubSender.js.map +1 -0
- package/dist/react-native/eventPosition.d.ts +73 -0
- package/dist/react-native/eventPosition.d.ts.map +1 -0
- package/dist/react-native/eventPosition.js +121 -0
- package/dist/react-native/eventPosition.js.map +1 -0
- package/dist/react-native/eventProcessor.d.ts +232 -0
- package/dist/react-native/eventProcessor.d.ts.map +1 -0
- package/dist/react-native/eventProcessor.js +389 -0
- package/dist/react-native/eventProcessor.js.map +1 -0
- package/dist/react-native/eventhubConnectionConfig.d.ts +96 -0
- package/dist/react-native/eventhubConnectionConfig.d.ts.map +1 -0
- package/dist/react-native/eventhubConnectionConfig.js +98 -0
- package/dist/react-native/eventhubConnectionConfig.js.map +1 -0
- package/dist/react-native/impl/awaitableQueue.d.ts +25 -0
- package/dist/react-native/impl/awaitableQueue.d.ts.map +1 -0
- package/dist/react-native/impl/awaitableQueue.js +51 -0
- package/dist/react-native/impl/awaitableQueue.js.map +1 -0
- package/dist/react-native/impl/partitionAssigner.d.ts +29 -0
- package/dist/react-native/impl/partitionAssigner.d.ts.map +1 -0
- package/dist/react-native/impl/partitionAssigner.js +52 -0
- package/dist/react-native/impl/partitionAssigner.js.map +1 -0
- package/dist/react-native/impl/partitionGate.d.ts +27 -0
- package/dist/react-native/impl/partitionGate.d.ts.map +1 -0
- package/dist/react-native/impl/partitionGate.js +38 -0
- package/dist/react-native/impl/partitionGate.js.map +1 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.d.ts +6 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.d.ts.map +1 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.js +111 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.js.map +1 -0
- package/dist/react-native/inMemoryCheckpointStore.d.ts +44 -0
- package/dist/react-native/inMemoryCheckpointStore.d.ts.map +1 -0
- package/dist/react-native/inMemoryCheckpointStore.js +94 -0
- package/dist/react-native/inMemoryCheckpointStore.js.map +1 -0
- package/dist/react-native/index.d.ts +21 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +12 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.js +40 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.js +29 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.js +245 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.js +22 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
- package/dist/react-native/logger.d.ts +37 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +56 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/managementClient.d.ts +145 -0
- package/dist/react-native/managementClient.d.ts.map +1 -0
- package/dist/react-native/managementClient.js +305 -0
- package/dist/react-native/managementClient.js.map +1 -0
- package/dist/react-native/models/private.d.ts +185 -0
- package/dist/react-native/models/private.d.ts.map +1 -0
- package/dist/react-native/models/private.js +4 -0
- package/dist/react-native/models/private.js.map +1 -0
- package/dist/react-native/models/public.d.ts +240 -0
- package/dist/react-native/models/public.d.ts.map +1 -0
- package/dist/react-native/models/public.js +18 -0
- package/dist/react-native/models/public.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/partitionProcessor.d.ts +134 -0
- package/dist/react-native/partitionProcessor.d.ts.map +1 -0
- package/dist/react-native/partitionProcessor.js +137 -0
- package/dist/react-native/partitionProcessor.js.map +1 -0
- package/dist/react-native/partitionPump.d.ts +38 -0
- package/dist/react-native/partitionPump.d.ts.map +1 -0
- package/dist/react-native/partitionPump.js +175 -0
- package/dist/react-native/partitionPump.js.map +1 -0
- package/dist/react-native/partitionReceiver.d.ts +82 -0
- package/dist/react-native/partitionReceiver.d.ts.map +1 -0
- package/dist/react-native/partitionReceiver.js +335 -0
- package/dist/react-native/partitionReceiver.js.map +1 -0
- package/dist/react-native/pumpManager.d.ts +72 -0
- package/dist/react-native/pumpManager.d.ts.map +1 -0
- package/dist/react-native/pumpManager.js +120 -0
- package/dist/react-native/pumpManager.js.map +1 -0
- package/dist/react-native/util/connectionStringUtils.d.ts +52 -0
- package/dist/react-native/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/react-native/util/connectionStringUtils.js +48 -0
- package/dist/react-native/util/connectionStringUtils.js.map +1 -0
- package/dist/react-native/util/constants.d.ts +25 -0
- package/dist/react-native/util/constants.d.ts.map +1 -0
- package/dist/react-native/util/constants.js +27 -0
- package/dist/react-native/util/constants.js.map +1 -0
- package/dist/react-native/util/delayWithoutThrow.d.ts +8 -0
- package/dist/react-native/util/delayWithoutThrow.d.ts.map +1 -0
- package/dist/react-native/util/delayWithoutThrow.js +17 -0
- package/dist/react-native/util/delayWithoutThrow.js.map +1 -0
- package/dist/react-native/util/error.d.ts +39 -0
- package/dist/react-native/util/error.d.ts.map +1 -0
- package/dist/react-native/util/error.js +103 -0
- package/dist/react-native/util/error.js.map +1 -0
- package/dist/react-native/util/getPromiseParts.d.ts +10 -0
- package/dist/react-native/util/getPromiseParts.d.ts.map +1 -0
- package/dist/react-native/util/getPromiseParts.js +20 -0
- package/dist/react-native/util/getPromiseParts.js.map +1 -0
- package/dist/react-native/util/operationOptions.d.ts +16 -0
- package/dist/react-native/util/operationOptions.d.ts.map +1 -0
- package/dist/react-native/util/operationOptions.js +4 -0
- package/dist/react-native/util/operationOptions.js.map +1 -0
- package/dist/react-native/util/parseEndpoint.d.ts +11 -0
- package/dist/react-native/util/parseEndpoint.d.ts.map +1 -0
- package/dist/react-native/util/parseEndpoint.js +17 -0
- package/dist/react-native/util/parseEndpoint.js.map +1 -0
- package/dist/react-native/util/retries.d.ts +6 -0
- package/dist/react-native/util/retries.d.ts.map +1 -0
- package/dist/react-native/util/retries.js +13 -0
- package/dist/react-native/util/retries.js.map +1 -0
- package/dist/react-native/util/runtimeInfo-react-native.d.mts.map +1 -0
- package/dist/react-native/util/runtimeInfo-react-native.mjs.map +1 -0
- package/dist/react-native/util/runtimeInfo.d.ts +6 -0
- package/dist/react-native/util/runtimeInfo.js +20 -0
- package/dist/react-native/util/timerLoop.d.ts +26 -0
- package/dist/react-native/util/timerLoop.d.ts.map +1 -0
- package/dist/react-native/util/timerLoop.js +34 -0
- package/dist/react-native/util/timerLoop.js.map +1 -0
- package/dist/react-native/util/typeGuards.d.ts +8 -0
- package/dist/react-native/util/typeGuards.d.ts.map +1 -0
- package/dist/react-native/util/typeGuards.js +12 -0
- package/dist/react-native/util/typeGuards.js.map +1 -0
- package/dist/react-native/util/utils.d.ts +7 -0
- package/dist/react-native/util/utils.d.ts.map +1 -0
- package/dist/react-native/util/utils.js +13 -0
- package/dist/react-native/util/utils.js.map +1 -0
- package/dist/react-native/withAuth.d.ts +25 -0
- package/dist/react-native/withAuth.d.ts.map +1 -0
- package/dist/react-native/withAuth.js +84 -0
- package/dist/react-native/withAuth.js.map +1 -0
- package/package.json +16 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventHubSender.js","sourceRoot":"","sources":["../../src/eventHubSender.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,EACL,KAAK,EACL,SAAS,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,oCAAoC,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AASpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,mCAAmC,EACnC,8BAA8B,EAC9B,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAA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QAC7B,yBAAyB;IAC3B,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AmqpError,\n AwaitableSender,\n AwaitableSenderOptions,\n EventContext,\n OnAmqpEvent,\n Message as RheaMessage,\n} from \"rhea-promise\";\nimport { message, types } from \"rhea-promise\";\nimport type { RetryConfig, RetryOptions } from \"@azure/core-amqp\";\nimport {\n ErrorNameConditionMapper,\n RetryOperationType,\n defaultCancellableLock,\n delay,\n retry,\n translate,\n} from \"@azure/core-amqp\";\nimport type { EventData, EventDataInternal } from \"./eventData.js\";\nimport { populateIdempotentMessageAnnotations, toRheaMessage } from \"./eventData.js\";\nimport type { EventDataBatch, EventDataBatchImpl } from \"./eventDataBatch.js\";\nimport { isEventDataBatch } from \"./eventDataBatch.js\";\nimport type { SimpleLogger } from \"./logger.js\";\nimport { logErrorStackTrace, createSimpleLogger, logger, createSenderLogPrefix } from \"./logger.js\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { ConnectionContext } from \"./connectionContext.js\";\nimport type { EventHubProducerOptions, IdempotentLinkProperties } from \"./models/private.js\";\nimport type { SendOptions } from \"./models/public.js\";\nimport type {\n PartitionPublishingOptions,\n PartitionPublishingProperties,\n} from \"./models/private.js\";\nimport { getRetryAttemptTimeoutInMs } from \"./util/retries.js\";\nimport {\n idempotentProducerAmqpPropertyNames,\n PENDING_PUBLISH_SEQ_NUM_SYMBOL,\n geoReplication,\n} from \"./util/constants.js\";\nimport { isDefined } from \"@azure/core-util\";\nimport { translateError } from \"./util/error.js\";\nimport type { TimerLoop } from \"./util/timerLoop.js\";\nimport { withAuth } from \"./withAuth.js\";\nimport { getRandomName } from \"./util/utils.js\";\n\n/**\n * @internal\n */\nexport interface EventHubSenderOptions {\n /**\n * Indicates whether or not the sender should enable idempotent publishing to Event Hub partitions.\n */\n enableIdempotentProducer: boolean;\n /**\n * The EventHub partition id to which the sender wants to send the event data.\n */\n partitionId?: string;\n /**\n * The set of options that can be specified to influence publishing behavior\n * specific to a partition.\n */\n partitionPublishingOptions?: PartitionPublishingOptions;\n}\n\n/**\n * Describes the EventHubSender that will send event data to EventHub.\n * @internal\n */\nexport class EventHubSender {\n /**\n * The unique lock name per connection that is used to acquire the\n * lock for establishing a sender link by an entity on that connection.\n */\n private readonly senderLock: string = getRandomName(\"sender\");\n /**\n * The handler function to handle errors that happen on the\n * underlying sender.\n */\n private readonly _onAmqpError: OnAmqpEvent;\n /**\n * The handler function to handle \"sender_close\" event\n * that happens on the underlying sender.\n */\n private readonly _onAmqpClose: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea sender's session for the \"session_error\" event.\n */\n private _onSessionError: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea sender's session for the \"session_close\" event.\n */\n private _onSessionClose: OnAmqpEvent;\n /**\n * The AMQP sender link.\n */\n private _sender?: AwaitableSender;\n /**\n * The partition ID.\n */\n private readonly partitionId?: string;\n /**\n * Indicates whether the sender is configured for idempotent publishing.\n */\n private _isIdempotentProducer: boolean;\n /**\n * Indicates whether the sender has an in-flight send while idempotent\n * publishing is enabled.\n */\n private _hasPendingSend?: boolean;\n /**\n * A local copy of the PartitionPublishingProperties that can be mutated to\n * keep track of the lastSequenceNumber used.\n */\n private _localPublishingProperties?: PartitionPublishingProperties;\n /**\n * The user-provided set of options that can be specified to influence\n * publishing behavior specific to a partition.\n */\n private _userProvidedPublishingOptions?: PartitionPublishingOptions;\n /**\n * Indicates whether the link is in the process of connecting\n * (establishing) itself. Default value: `false`.\n */\n private isConnecting: boolean = false;\n /**\n * The unique name for the entity (mostly a guid).\n */\n private readonly name: string;\n /**\n * The address in the following form:\n * - `\"<hubName>\"`\n * - `\"<hubName>/Partitions/<partitionId>\"`.\n */\n private readonly address: string;\n /**\n * The token audience in the following form:\n * - `\"sb://<yournamespace>.servicebus.windows.net/<hubName>\"`\n * - `\"sb://<yournamespace>.servicebus.windows.net/<hubName>/Partitions/<partitionId>\"`.\n */\n private readonly audience: string;\n /**\n * Provides relevant information about the amqp connection,\n * cbs and $management sessions, token provider, sender and receivers.\n */\n private readonly _context: ConnectionContext;\n /**\n * The auth loop.\n */\n private authLoop?: TimerLoop;\n /**\n * The logger.\n */\n private readonly logger: SimpleLogger;\n\n /** The client identifier */\n private _id: string;\n\n /**\n * Creates a new EventHubSender instance.\n * @param context - The connection context.\n * @param options - Options used to configure the EventHubSender.\n */\n constructor(\n context: ConnectionContext,\n senderId: string,\n { partitionId, enableIdempotentProducer, partitionPublishingOptions }: EventHubSenderOptions,\n ) {\n this.address = context.config.getSenderAddress(partitionId);\n this.name = this.address;\n this._id = senderId;\n this.audience = context.config.getSenderAudience(partitionId);\n this._context = context;\n this.partitionId = partitionId;\n this._isIdempotentProducer = enableIdempotentProducer;\n this._userProvidedPublishingOptions = partitionPublishingOptions;\n const logPrefix = createSenderLogPrefix(this.name, this._context.connectionId);\n this.logger = createSimpleLogger(logger, logPrefix);\n\n this._onAmqpError = (eventContext: EventContext) => {\n const senderError = eventContext.sender && eventContext.sender.error;\n this.logger.verbose(\n \"'sender_error' event occurred. The associated error is: %O\",\n senderError,\n );\n // TODO: Consider rejecting promise in trySendBatch() or createBatch()\n };\n\n this._onSessionError = (eventContext: EventContext) => {\n const sessionError = eventContext.session && eventContext.session.error;\n this.logger.verbose(\n \"'session_error' event occurred. The associated error is: %O\",\n sessionError,\n );\n // TODO: Consider rejecting promise in trySendBatch() or createBatch()\n };\n\n this._onAmqpClose = (eventContext: EventContext) => {\n const sender = this._sender || eventContext.sender!;\n this.logger.verbose(\n \"'sender_close' event occurred. Value for isItselfClosed on the receiver is: '%s' \" +\n \"Value for isConnecting on the session is: '%s'.\",\n sender?.isItselfClosed().toString(),\n this.isConnecting,\n );\n if (sender && !this.isConnecting) {\n // Call close to clean up timers & other resources\n // Fire-and-forget close operation with error handling\n sender.close().catch((err) => {\n this.logger.verbose(\"error when closing after 'sender_close' event: %O\", err);\n });\n }\n };\n\n this._onSessionClose = (eventContext: EventContext) => {\n const sender = this._sender || eventContext.sender!;\n this.logger.verbose(\n \"'session_close' event occurred. Value for isSessionItselfClosed on the session is: '%s' \" +\n \"Value for isConnecting on the session is: '%s'.\",\n sender?.isSessionItselfClosed().toString(),\n this.isConnecting,\n );\n if (sender && !this.isConnecting) {\n // Call close to clean up timers & other resources\n // Fire-and-forget close operation with error handling\n sender.close().catch((err) => {\n this.logger.verbose(\"error when closing after 'session_close' event: %O\", err);\n });\n }\n };\n }\n\n /**\n * Deletes the sender from the context. Clears the token renewal timer. Closes the sender link.\n */\n async close(): Promise<void> {\n try {\n if (this._sender) {\n this.logger.info(\"closing\");\n const senderLink = this._sender;\n this._deleteFromCache();\n await senderLink.close();\n this.authLoop?.stop();\n this.logger.verbose(\"closed.\");\n }\n } catch (err: any) {\n const msg = `an error occurred while closing: ${err?.name}: ${err?.message}`;\n this.logger.warning(msg);\n logErrorStackTrace(err);\n throw err;\n }\n }\n\n /**\n * Determines whether the AMQP sender link is open. If open then returns true else returns false.\n * @returns boolean\n */\n isOpen(): boolean {\n const result = Boolean(this._sender && this._sender.isOpen());\n this.logger.verbose(\"is open? -> %s\", result);\n return result;\n }\n /**\n * Returns maximum message size on the AMQP sender link.\n * @param abortSignal - An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.\n * For example, use the @azure/abort-controller to create an `AbortSignal`.\n * @returns Promise<number>\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n async getMaxMessageSize(\n options: {\n retryOptions?: RetryOptions;\n abortSignal?: AbortSignalLike;\n } = {},\n ): Promise<number> {\n const sender = await this._getLink(options);\n\n return sender.maxMessageSize;\n }\n\n /**\n * Get the information about the state of publishing for a partition as observed by the `EventHubSender`.\n * This data can always be read, but will only be populated with information relevant to the active features\n * for the producer client.\n */\n async getPartitionPublishingProperties(\n options: {\n retryOptions?: RetryOptions;\n abortSignal?: AbortSignalLike;\n } = {},\n ): Promise<PartitionPublishingProperties> {\n if (this._localPublishingProperties) {\n // Send a copy of the properties so it can't be mutated downstream.\n return { ...this._localPublishingProperties };\n }\n\n const properties: PartitionPublishingProperties = {\n isIdempotentPublishingEnabled: this._isIdempotentProducer,\n partitionId: this.partitionId ?? \"\",\n };\n\n if (this._isIdempotentProducer) {\n this._sender = await this._getLink(options);\n // await this._createLinkIfNotOpen(options);\n if (!this._sender) {\n // createLinkIfNotOpen should throw if `this._sender` can't be created, but just in case it gets\n // deleted while setting up token refreshing, make sure it exists.\n throw new Error(\n `Failed to retrieve partition publishing properties for partition \"${this.partitionId}\".`,\n );\n }\n\n const {\n [idempotentProducerAmqpPropertyNames.epoch]: ownerLevel,\n [idempotentProducerAmqpPropertyNames.producerId]: producerGroupId,\n [idempotentProducerAmqpPropertyNames.producerSequenceNumber]: lastPublishedSequenceNumber,\n } = this._sender.properties ?? {};\n\n properties.ownerLevel = parseInt(ownerLevel, 10);\n properties.producerGroupId = parseInt(producerGroupId, 10);\n properties.lastPublishedSequenceNumber = parseInt(lastPublishedSequenceNumber, 10);\n }\n\n this._localPublishingProperties = properties;\n\n // Send a copy of the properties so it can't be mutated downstream.\n return { ...properties };\n }\n\n /**\n * Send a batch of EventData to the EventHub. The \"message_annotations\",\n * \"application_properties\" and \"properties\" of the first message will be set as that\n * of the envelope (batch message).\n * @param events - An array of EventData objects to be sent in a Batch message.\n * @param options - Options to control the way the events are batched along with request options\n */\n async send(\n events: EventData[] | EventDataBatch,\n options?: SendOptions &\n EventHubProducerOptions & { tracingProperties?: Array<EventData[\"properties\"]> },\n ): Promise<void> {\n try {\n this.logger.info(\"trying to send EventData[].\");\n if (this._isIdempotentProducer && this._hasPendingSend) {\n throw new Error(\n `There can only be 1 \"sendBatch\" call in-flight per partition while \"enableIdempotentRetries\" is set to true.`,\n );\n }\n\n const eventCount = isEventDataBatch(events) ? events.count : events.length;\n if (eventCount === 0) {\n this.logger.info(`no events were passed to sendBatch.`);\n return;\n }\n\n if (this._isIdempotentProducer) {\n this._hasPendingSend = true;\n }\n\n this.logger.info(\"sending encoded batch message.\");\n await this._trySendBatch(events, options);\n if (this._isIdempotentProducer) {\n commitIdempotentSequenceNumbers(events);\n if (this._localPublishingProperties) {\n const { lastPublishedSequenceNumber = 0 } = this._localPublishingProperties;\n // Increment the lastPublishedSequenceNumber based on the number of events published.\n this._localPublishingProperties.lastPublishedSequenceNumber =\n lastPublishedSequenceNumber + eventCount;\n }\n }\n return;\n } catch (err: any) {\n rollbackIdempotentSequenceNumbers(events);\n this.logger.warning(\n `an error occurred while sending the batch message ${err?.name}: ${err?.message}`,\n );\n logErrorStackTrace(err);\n throw err;\n } finally {\n if (this._isIdempotentProducer) {\n this._hasPendingSend = false;\n }\n }\n }\n\n /**\n * @param sender - The rhea sender that contains the idempotent producer properties.\n */\n private _populateLocalPublishingProperties(sender: AwaitableSender): void {\n const {\n [idempotentProducerAmqpPropertyNames.epoch]: ownerLevel,\n [idempotentProducerAmqpPropertyNames.producerId]: producerGroupId,\n [idempotentProducerAmqpPropertyNames.producerSequenceNumber]: lastPublishedSequenceNumber,\n } = sender.properties ?? {};\n\n this._localPublishingProperties = {\n isIdempotentPublishingEnabled: this._isIdempotentProducer,\n partitionId: this.partitionId ?? \"\",\n lastPublishedSequenceNumber,\n ownerLevel,\n producerGroupId,\n };\n }\n\n private _deleteFromCache(): void {\n this._sender = undefined;\n delete this._context.senders[this.name];\n this.logger.verbose(\"deleted from the client cache.\");\n }\n\n private _createSenderOptions(): AwaitableSenderOptions {\n const srOptions: AwaitableSenderOptions = {\n name: this.name,\n source: this._id,\n target: {\n address: this.address,\n },\n onError: this._onAmqpError,\n onClose: this._onAmqpClose,\n onSessionError: this._onSessionError,\n onSessionClose: this._onSessionClose,\n };\n\n srOptions.desired_capabilities = [geoReplication];\n if (this._isIdempotentProducer) {\n srOptions.desired_capabilities.push(idempotentProducerAmqpPropertyNames.capability);\n const idempotentProperties = generateIdempotentLinkProperties(\n this._userProvidedPublishingOptions,\n this._localPublishingProperties,\n );\n srOptions.properties = idempotentProperties;\n }\n this.logger.verbose(\"being created with options: %O\", srOptions);\n return srOptions;\n }\n\n /**\n * Tries to send the message to EventHub if there is enough credit to send them\n * and the circular buffer has available space to settle the message after sending them.\n *\n * We have implemented a synchronous send over here in the sense that we shall be waiting\n * for the message to be accepted or rejected and accordingly resolve or reject the promise.\n * @param rheaMessage - The message to be sent to EventHub.\n * @returns Promise<void>\n */\n private async _trySendBatch(\n events: EventData[] | EventDataBatch,\n options: SendOptions &\n EventHubProducerOptions & {\n /**\n * Tracing properties that are associated with EventData.\n */\n tracingProperties?: Array<EventData[\"properties\"]>;\n } = {},\n ): Promise<void> {\n const abortSignal: AbortSignalLike | undefined = options.abortSignal;\n const retryOptions = options.retryOptions || {};\n const timeoutInMs = getRetryAttemptTimeoutInMs(retryOptions);\n retryOptions.timeoutInMs = timeoutInMs;\n\n const sendEventPromise = async (): Promise<void> => {\n const initStartTime = Date.now();\n // TODO: (jeremymeng) A or B\n // variant A:\n const sender = await this._getLink(options);\n // variant B\n // await this._createLinkIfNotOpen(options);\n const publishingProps = await this.getPartitionPublishingProperties(options);\n const timeTakenByInit = Date.now() - initStartTime;\n\n this.logger.verbose(\n \"credit: %d available: %d\",\n sender.credit,\n sender.session.outgoing.available(),\n );\n\n let waitTimeForSendable = 1000;\n if (!sender.sendable() && timeoutInMs - timeTakenByInit > waitTimeForSendable) {\n this.logger.verbose(\"waiting for 1 second for sender to become sendable\");\n\n await delay(waitTimeForSendable);\n\n this.logger.verbose(\n \"after waiting for a second, credit: %d available: %d\",\n sender.credit,\n sender.session?.outgoing?.available(),\n );\n } else {\n waitTimeForSendable = 0;\n }\n\n if (!sender.sendable()) {\n // let us retry to send the message after some time.\n const msg = `cannot send the message right now. Please try later.`;\n this.logger.warning(msg);\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SenderBusyError,\n description: msg,\n };\n throw translate(amqpError);\n }\n\n if (timeoutInMs <= timeTakenByInit + waitTimeForSendable) {\n const desc: string =\n `was not able to send the message right now, due ` + `to operation timeout.`;\n this.logger.warning(desc);\n const e: AmqpError = {\n condition: ErrorNameConditionMapper.ServiceUnavailableError,\n description: desc,\n };\n throw translate(e);\n }\n\n try {\n const encodedMessage = transformEventsForSend(events, publishingProps, options);\n const delivery = await sender.send(encodedMessage, {\n format: 0x80013700,\n timeoutInSeconds: (timeoutInMs - timeTakenByInit - waitTimeForSendable) / 1000,\n abortSignal,\n });\n this.logger.info(\"sent message with delivery id: %d\", delivery.id);\n } catch (err: any) {\n const error = err.innerError || err;\n const translatedError = translateError(error);\n throw translatedError;\n }\n };\n\n const config: RetryConfig<void> = {\n operation: sendEventPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.sendMessage,\n abortSignal: abortSignal,\n retryOptions: retryOptions,\n };\n\n try {\n await retry<void>(config);\n } catch (err: any) {\n const translatedError = translate(err);\n this.logger.warning(\n \"an error occurred while sending the message %s\",\n `${translatedError?.name}: ${translatedError?.message}`,\n );\n logErrorStackTrace(translatedError);\n throw translatedError;\n }\n }\n\n private async _getLink(\n options: {\n retryOptions?: RetryOptions;\n abortSignal?: AbortSignalLike;\n } = {},\n ): Promise<AwaitableSender> {\n if (this.isOpen() && this._sender) {\n return this._sender;\n }\n const retryOptions = options.retryOptions || {};\n const timeoutInMs = getRetryAttemptTimeoutInMs(retryOptions);\n retryOptions.timeoutInMs = timeoutInMs;\n const senderOptions = this._createSenderOptions();\n\n const startTime = Date.now();\n const createLinkPromise = async (): Promise<AwaitableSender> => {\n return defaultCancellableLock.acquire(\n this.senderLock,\n () => {\n const taskStartTime = Date.now();\n const taskTimeoutInMs = timeoutInMs - (taskStartTime - startTime);\n return this._init({\n ...senderOptions,\n abortSignal: options.abortSignal,\n timeoutInMs: taskTimeoutInMs,\n });\n },\n { abortSignal: options.abortSignal, timeoutInMs: timeoutInMs },\n );\n };\n\n const config: RetryConfig<AwaitableSender> = {\n operation: createLinkPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.senderLink,\n abortSignal: options.abortSignal,\n retryOptions: retryOptions,\n };\n\n try {\n return await retry<AwaitableSender>(config);\n } catch (err: any) {\n const translatedError = translate(err);\n this.logger.warning(\n \"an error occurred while creating: %s\",\n `${translatedError?.name}: ${translatedError?.message}`,\n );\n logErrorStackTrace(translatedError);\n throw translatedError;\n }\n }\n\n /**\n * Initializes the sender session on the connection.\n * Should only be called from _createLinkIfNotOpen\n */\n private async _init(\n options: AwaitableSenderOptions & {\n abortSignal: AbortSignalLike | undefined;\n timeoutInMs: number;\n },\n ): Promise<AwaitableSender> {\n const createSender = async () => {\n this.logger.verbose(\"trying to be created...\");\n\n const sender = await this._context.connection.createAwaitableSender(options);\n this._sender = sender;\n this._populateLocalPublishingProperties(this._sender);\n this.isConnecting = false;\n this.logger.verbose(\"created with options: %O\", options);\n\n // It is possible for someone to close the sender and then start it again.\n // Thus make sure that the sender is present in the client cache.\n if (!this._context.senders[this.name]) this._context.senders[this.name] = this;\n };\n try {\n if (!this.isOpen() || !this._sender) {\n await this._context.readyToOpenLink();\n this.authLoop = await withAuth(\n createSender,\n this._context,\n this.audience,\n options.timeoutInMs,\n this.logger,\n { abortSignal: options.abortSignal },\n );\n // it is guaranteed to be defined at this point, otherwise, an error would\n // have been thrown.\n return this._sender!;\n } else {\n this.logger.verbose(\"is open -> %s. Hence not reconnecting.\", this.isOpen());\n return this._sender;\n }\n } catch (err) {\n const translatedError = translate(err);\n this.logger.warning(\n \"an error occurred while being created: %s\",\n `${translatedError?.name}: ${translatedError?.message}`,\n );\n logErrorStackTrace(translatedError);\n throw translatedError;\n }\n }\n\n /**\n * Creates a new sender to the given event hub, and optionally to a given partition if it is\n * not present in the context or returns the one present in the context.\n * @hidden\n * @param options - Options used to configure the EventHubSender.\n */\n static create(\n context: ConnectionContext,\n senderId: string,\n options: EventHubSenderOptions,\n ): EventHubSender {\n const ehSender: EventHubSender = new EventHubSender(context, senderId, options);\n if (!context.senders[ehSender.name]) {\n context.senders[ehSender.name] = ehSender;\n }\n return context.senders[ehSender.name];\n }\n}\n\n/**\n * Generates the link properties for an indemopotent sender given\n * based on the user-provided and locally-cached publishing options.\n *\n * Note: The set of idempotent properties a user specifies at EventHubProducerClient instantiation-time\n * is slightly different than what the service returns and the EventHubSender keeps track of locally.\n *\n * The difference is that the user specifies the `startingSequenceNumber`, whereas the local options\n * (those returned by getPartitionPublishingProperties) specifies `lastPublishedSequenceNumber`.\n *\n * These _can_ be the same, but the user is technically free to set any `startingSequenceNumber` they want.\n * @internal\n */\nexport function generateIdempotentLinkProperties(\n userProvidedPublishingOptions: PartitionPublishingOptions | undefined,\n localPublishingOptions: PartitionPublishingProperties | undefined,\n): IdempotentLinkProperties | Record<string, never> {\n let ownerLevel: number | undefined;\n let producerGroupId: number | undefined;\n let sequenceNumber: number | undefined;\n\n // Prefer local publishing options since this is the up-to-date state of the sender.\n // Only use user-provided publishing options the first time we create the link.\n if (localPublishingOptions) {\n ownerLevel = localPublishingOptions.ownerLevel;\n producerGroupId = localPublishingOptions.producerGroupId;\n sequenceNumber = localPublishingOptions.lastPublishedSequenceNumber;\n } else if (userProvidedPublishingOptions) {\n ownerLevel = userProvidedPublishingOptions.ownerLevel;\n producerGroupId = userProvidedPublishingOptions.producerGroupId;\n sequenceNumber = userProvidedPublishingOptions.startingSequenceNumber;\n } else {\n // If we don't have any properties at all, send an empty object.\n // This will cause the service to generate a new producer-id for our client.\n return {};\n }\n\n // The service requires that if ANY_ of these properties are defined,\n // they _ALL_ have to be defined.\n // If we don't have one of the required values, use `null` and the\n // service will provide it.\n const idempotentLinkProperties: IdempotentLinkProperties = {\n [idempotentProducerAmqpPropertyNames.epoch]: isDefined(ownerLevel)\n ? types.wrap_short(ownerLevel)\n : null,\n [idempotentProducerAmqpPropertyNames.producerId]: isDefined(producerGroupId)\n ? types.wrap_long(producerGroupId)\n : null,\n [idempotentProducerAmqpPropertyNames.producerSequenceNumber]: isDefined(sequenceNumber)\n ? types.wrap_int(sequenceNumber)\n : null,\n };\n\n return idempotentLinkProperties;\n}\n\n/**\n * Encodes a list or batch of events into a single binary message that can be sent to the service.\n *\n * Prior to encoding, any special properties not specified by the user, such as tracing or idempotent\n * properties, are assigned to the list or batch of events as needed.\n *\n * @internal\n * @param events - Events to transform for sending to the service.\n * @param publishingProps - Describes the current publishing state for the partition.\n * @param options - Options used to configure this function.\n */\nexport function transformEventsForSend(\n events: EventData[] | EventDataBatch,\n publishingProps: PartitionPublishingProperties,\n options: SendOptions & {\n /**\n * A list containing the `Diagnostic-Id` tracing property that is associated with each EventData.\n * The index of tracingProperties corresponds to the same index in `events` when `events` is EventData[].\n */\n tracingProperties?: Array<EventData[\"properties\"]>;\n } = {},\n): Buffer {\n if (isEventDataBatch(events)) {\n return (events as EventDataBatchImpl)._generateMessage(publishingProps);\n } else {\n const eventCount = events.length;\n // convert events to rhea messages\n const rheaMessages: RheaMessage[] = [];\n const tracingProperties = options.tracingProperties ?? [];\n for (let i = 0; i < eventCount; i++) {\n const originalEvent = events[i];\n const tracingProperty = tracingProperties[i];\n // Create a copy of the user's event so we can add the tracing property.\n const event: EventData = {\n ...originalEvent,\n properties: { ...originalEvent.properties, ...tracingProperty },\n };\n const rheaMessage = toRheaMessage(event, options.partitionKey);\n\n // populate idempotent message annotations\n const { lastPublishedSequenceNumber = 0 } = publishingProps;\n const startingSequenceNumber = lastPublishedSequenceNumber + 1;\n const pendingPublishSequenceNumber = startingSequenceNumber + i;\n populateIdempotentMessageAnnotations(rheaMessage, {\n ...publishingProps,\n publishSequenceNumber: pendingPublishSequenceNumber,\n });\n\n if (publishingProps.isIdempotentPublishingEnabled) {\n // Set pending seq number on user's event.\n (originalEvent as EventDataInternal)[PENDING_PUBLISH_SEQ_NUM_SYMBOL] =\n pendingPublishSequenceNumber;\n }\n\n rheaMessages.push(rheaMessage);\n }\n\n // Encode every amqp message and then convert every encoded message to amqp data section\n const batchMessage: RheaMessage = {\n body: message.data_sections(rheaMessages.map(message.encode)),\n };\n\n // Set message_annotations of the first message as\n // that of the envelope (batch message).\n if (rheaMessages[0].message_annotations) {\n batchMessage.message_annotations = { ...rheaMessages[0].message_annotations };\n }\n\n // Finally encode the envelope (batch message).\n return message.encode(batchMessage);\n }\n}\n\n/**\n * Commits the pending publish sequence number events.\n * EventDataBatch exposes this as `startingPublishSequenceNumber`,\n * EventData not in a batch exposes this as `publishedSequenceNumber`.\n */\nfunction commitIdempotentSequenceNumbers(\n events: Omit<EventDataInternal, \"getRawAmqpMessage\">[] | EventDataBatch,\n): void {\n if (isEventDataBatch(events)) {\n (events as EventDataBatchImpl)._commitPublish();\n } else {\n // For each event, set the `publishedSequenceNumber` equal to the sequence number\n // we set when we attempted to send the events to the service.\n for (const event of events) {\n event._publishedSequenceNumber = event[PENDING_PUBLISH_SEQ_NUM_SYMBOL];\n delete event[PENDING_PUBLISH_SEQ_NUM_SYMBOL];\n }\n }\n}\n\n/**\n * Rolls back any pending publish sequence number in the events.\n */\nfunction rollbackIdempotentSequenceNumbers(\n events: Omit<EventDataInternal, \"getRawAmqpMessage\">[] | EventDataBatch,\n): void {\n if (isEventDataBatch(events)) {\n /* No action required. */\n } else {\n for (const event of events) {\n delete event[PENDING_PUBLISH_SEQ_NUM_SYMBOL];\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the position of an event in an Event Hub partition, typically used when calling the `subscribe()`
|
|
3
|
+
* method on an `EventHubConsumerClient` to specify the position in the partition to begin receiving events from.
|
|
4
|
+
*
|
|
5
|
+
* To get an EventPosition representing the start or end of the stream, use the constants
|
|
6
|
+
* `earliestEventPosition` and `latestEventPosition` respectively.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export interface EventPosition {
|
|
10
|
+
/**
|
|
11
|
+
* The offset of the event identified by this position.
|
|
12
|
+
* Expected to be undefined if the position is just created from a sequence number or an enqueued time.
|
|
13
|
+
*
|
|
14
|
+
* The offset is the relative position for an event in the context of the partition.
|
|
15
|
+
* The offset should not be considered a stable value.
|
|
16
|
+
* The same offset may refer to a different event as events reach the age limit for
|
|
17
|
+
* retention and are no longer visible within the partition.
|
|
18
|
+
*/
|
|
19
|
+
offset?: string | "@latest";
|
|
20
|
+
/**
|
|
21
|
+
* Indicates if the specified offset is inclusive of the event which it identifies.
|
|
22
|
+
* This information is only relevent if the event position was identified by an offset or sequence number.
|
|
23
|
+
* Default value: `false`.
|
|
24
|
+
*/
|
|
25
|
+
isInclusive?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The enqueued time in UTC of the event identified by this position.
|
|
28
|
+
* When provided as a number this value is the number of milliseconds since the Unix Epoch.
|
|
29
|
+
* Expected to be undefined if the position is just created from a sequence number or an offset.
|
|
30
|
+
*/
|
|
31
|
+
enqueuedOn?: Date | number;
|
|
32
|
+
/**
|
|
33
|
+
* The sequence number of the event identified by this position.
|
|
34
|
+
* Expected to be undefined if the position is just created from an offset or enqueued time.
|
|
35
|
+
*/
|
|
36
|
+
sequenceNumber?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
* Gets the expression to be set as the filter clause when creating the receiver
|
|
41
|
+
* @returns filterExpression
|
|
42
|
+
*/
|
|
43
|
+
export declare function getEventPositionFilter(eventPosition: EventPosition): string;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare function isLatestPosition(eventPosition: EventPosition): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the `EventPosition` corresponding to the location of the the first event present in the partition.
|
|
50
|
+
* Pass this position to the `EventHubConsumerClient.subscribe()` method to begin receiving events from the
|
|
51
|
+
* first event in the partition which has not expired due to the retention policy.
|
|
52
|
+
*/
|
|
53
|
+
export declare const earliestEventPosition: EventPosition;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the `EventPosition` corresponding to the end of the partition.
|
|
56
|
+
* Pass this position to the `EventHubConsumerClient.subscribe()` method to begin receiving events from the
|
|
57
|
+
* event that is enqueued right after the method call.
|
|
58
|
+
* @returns EventPosition
|
|
59
|
+
*/
|
|
60
|
+
export declare const latestEventPosition: EventPosition;
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare function validateEventPositions(position: EventPosition | {
|
|
65
|
+
[partitionId: string]: EventPosition;
|
|
66
|
+
}): void;
|
|
67
|
+
/**
|
|
68
|
+
* Determines whether a position is an EventPosition.
|
|
69
|
+
* Does not validate that the position is allowed.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export declare function isEventPosition(position: unknown): position is EventPosition;
|
|
73
|
+
//# sourceMappingURL=eventPosition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventPosition.d.ts","sourceRoot":"","sources":["../../src/eventPosition.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAE3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CA0B3E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAMtE;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAEnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAEjC,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,aAAa,GAAG;IAAE,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,GACjE,IAAI,CAwBN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,aAAa,CAkB5E"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { Constants, ErrorNameConditionMapper, translate } from "@azure/core-amqp";
|
|
4
|
+
import { isDefined, objectHasProperty } from "@azure/core-util";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Gets the expression to be set as the filter clause when creating the receiver
|
|
8
|
+
* @returns filterExpression
|
|
9
|
+
*/
|
|
10
|
+
export function getEventPositionFilter(eventPosition) {
|
|
11
|
+
let result;
|
|
12
|
+
// order of preference
|
|
13
|
+
if (isDefined(eventPosition.offset)) {
|
|
14
|
+
result = eventPosition.isInclusive
|
|
15
|
+
? `${Constants.offsetAnnotation} >= '${eventPosition.offset}'`
|
|
16
|
+
: `${Constants.offsetAnnotation} > '${eventPosition.offset}'`;
|
|
17
|
+
}
|
|
18
|
+
else if (isDefined(eventPosition.sequenceNumber)) {
|
|
19
|
+
result = eventPosition.isInclusive
|
|
20
|
+
? `${Constants.sequenceNumberAnnotation} >= '${eventPosition.sequenceNumber}'`
|
|
21
|
+
: `${Constants.sequenceNumberAnnotation} > '${eventPosition.sequenceNumber}'`;
|
|
22
|
+
}
|
|
23
|
+
else if (isDefined(eventPosition.enqueuedOn)) {
|
|
24
|
+
const time = eventPosition.enqueuedOn instanceof Date
|
|
25
|
+
? eventPosition.enqueuedOn.getTime()
|
|
26
|
+
: eventPosition.enqueuedOn;
|
|
27
|
+
result = `${Constants.enqueuedTimeAnnotation} > '${time}'`;
|
|
28
|
+
}
|
|
29
|
+
if (!result) {
|
|
30
|
+
throw translate({
|
|
31
|
+
condition: ErrorNameConditionMapper.ArgumentError,
|
|
32
|
+
description: "No starting position was set in the EventPosition.",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export function isLatestPosition(eventPosition) {
|
|
41
|
+
if (eventPosition.offset === "@latest") {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets the `EventPosition` corresponding to the location of the the first event present in the partition.
|
|
48
|
+
* Pass this position to the `EventHubConsumerClient.subscribe()` method to begin receiving events from the
|
|
49
|
+
* first event in the partition which has not expired due to the retention policy.
|
|
50
|
+
*/
|
|
51
|
+
export const earliestEventPosition = {
|
|
52
|
+
offset: "-1",
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Gets the `EventPosition` corresponding to the end of the partition.
|
|
56
|
+
* Pass this position to the `EventHubConsumerClient.subscribe()` method to begin receiving events from the
|
|
57
|
+
* event that is enqueued right after the method call.
|
|
58
|
+
* @returns EventPosition
|
|
59
|
+
*/
|
|
60
|
+
export const latestEventPosition = {
|
|
61
|
+
offset: "@latest",
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export function validateEventPositions(position) {
|
|
67
|
+
if (!isDefined(position)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const keys = Object.keys(position);
|
|
71
|
+
if (!keys.length) {
|
|
72
|
+
throw new TypeError("Invalid value for EventPosition found. Pass an object with either of offset, sequenceNumber or enqueuedOn properties set.");
|
|
73
|
+
}
|
|
74
|
+
if (isEventPosition(position)) {
|
|
75
|
+
validateEventPosition(position);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const positions = position;
|
|
79
|
+
for (let i = 0; i < keys.length; i++) {
|
|
80
|
+
if (Object.prototype.hasOwnProperty.call(positions, keys[i])) {
|
|
81
|
+
validateEventPosition(positions[keys[i]]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Determines whether a position is an EventPosition.
|
|
87
|
+
* Does not validate that the position is allowed.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export function isEventPosition(position) {
|
|
91
|
+
if (!position) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (objectHasProperty(position, "offset") && isDefined(position.offset)) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (objectHasProperty(position, "sequenceNumber") && isDefined(position.sequenceNumber)) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
if (objectHasProperty(position, "enqueuedOn") && isDefined(position.enqueuedOn)) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
function validateEventPosition(position) {
|
|
106
|
+
if (!isDefined(position)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const offsetPresent = isDefined(position.offset);
|
|
110
|
+
const sequenceNumberPresent = isDefined(position.sequenceNumber);
|
|
111
|
+
const enqueuedOnPresent = isDefined(position.enqueuedOn);
|
|
112
|
+
if ((offsetPresent && sequenceNumberPresent) ||
|
|
113
|
+
(offsetPresent && enqueuedOnPresent) ||
|
|
114
|
+
(enqueuedOnPresent && sequenceNumberPresent)) {
|
|
115
|
+
throw new TypeError("Invalid value for EventPosition found. Set only one of offset, sequenceNumber or enqueuedOn properties.");
|
|
116
|
+
}
|
|
117
|
+
if (!offsetPresent && !enqueuedOnPresent && !sequenceNumberPresent) {
|
|
118
|
+
throw new TypeError("Invalid value for EventPosition found. Pass an object with either of offset, sequenceNumber or enqueuedOn properties set.");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=eventPosition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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C5H,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Constants, ErrorNameConditionMapper, translate } from \"@azure/core-amqp\";\nimport { isDefined, objectHasProperty } from \"@azure/core-util\";\n\n/**\n * Represents the position of an event in an Event Hub partition, typically used when calling the `subscribe()`\n * method on an `EventHubConsumerClient` to specify the position in the partition to begin receiving events from.\n *\n * To get an EventPosition representing the start or end of the stream, use the constants\n * `earliestEventPosition` and `latestEventPosition` respectively.\n *\n */\nexport interface EventPosition {\n /**\n * The offset of the event identified by this position.\n * Expected to be undefined if the position is just created from a sequence number or an enqueued time.\n *\n * The offset is the relative position for an event in the context of the partition.\n * The offset should not be considered a stable value.\n * The same offset may refer to a different event as events reach the age limit for\n * retention and are no longer visible within the partition.\n */\n offset?: string | \"@latest\";\n /**\n * Indicates if the specified offset is inclusive of the event which it identifies.\n * This information is only relevent if the event position was identified by an offset or sequence number.\n * Default value: `false`.\n */\n isInclusive?: boolean;\n /**\n * The enqueued time in UTC of the event identified by this position.\n * When provided as a number this value is the number of milliseconds since the Unix Epoch.\n * Expected to be undefined if the position is just created from a sequence number or an offset.\n */\n enqueuedOn?: Date | number;\n\n /**\n * The sequence number of the event identified by this position.\n * Expected to be undefined if the position is just created from an offset or enqueued time.\n */\n sequenceNumber?: number;\n}\n\n/**\n * @internal\n * Gets the expression to be set as the filter clause when creating the receiver\n * @returns filterExpression\n */\nexport function getEventPositionFilter(eventPosition: EventPosition): string {\n let result;\n // order of preference\n if (isDefined(eventPosition.offset)) {\n result = eventPosition.isInclusive\n ? `${Constants.offsetAnnotation} >= '${eventPosition.offset}'`\n : `${Constants.offsetAnnotation} > '${eventPosition.offset}'`;\n } else if (isDefined(eventPosition.sequenceNumber)) {\n result = eventPosition.isInclusive\n ? `${Constants.sequenceNumberAnnotation} >= '${eventPosition.sequenceNumber}'`\n : `${Constants.sequenceNumberAnnotation} > '${eventPosition.sequenceNumber}'`;\n } else if (isDefined(eventPosition.enqueuedOn)) {\n const time =\n eventPosition.enqueuedOn instanceof Date\n ? eventPosition.enqueuedOn.getTime()\n : eventPosition.enqueuedOn;\n result = `${Constants.enqueuedTimeAnnotation} > '${time}'`;\n }\n\n if (!result) {\n throw translate({\n condition: ErrorNameConditionMapper.ArgumentError,\n description: \"No starting position was set in the EventPosition.\",\n });\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport function isLatestPosition(eventPosition: EventPosition): boolean {\n if (eventPosition.offset === \"@latest\") {\n return true;\n }\n\n return false;\n}\n\n/**\n * Gets the `EventPosition` corresponding to the location of the the first event present in the partition.\n * Pass this position to the `EventHubConsumerClient.subscribe()` method to begin receiving events from the\n * first event in the partition which has not expired due to the retention policy.\n */\nexport const earliestEventPosition: EventPosition = {\n offset: \"-1\",\n};\n\n/**\n * Gets the `EventPosition` corresponding to the end of the partition.\n * Pass this position to the `EventHubConsumerClient.subscribe()` method to begin receiving events from the\n * event that is enqueued right after the method call.\n * @returns EventPosition\n */\nexport const latestEventPosition: EventPosition = {\n offset: \"@latest\",\n};\n\n/**\n * @internal\n */\nexport function validateEventPositions(\n position: EventPosition | { [partitionId: string]: EventPosition },\n): void {\n if (!isDefined(position)) {\n return;\n }\n\n const keys = Object.keys(position);\n\n if (!keys.length) {\n throw new TypeError(\n \"Invalid value for EventPosition found. Pass an object with either of offset, sequenceNumber or enqueuedOn properties set.\",\n );\n }\n\n if (isEventPosition(position)) {\n validateEventPosition(position);\n return;\n }\n\n const positions = position as { [partitionId: string]: EventPosition };\n for (let i = 0; i < keys.length; i++) {\n if (Object.prototype.hasOwnProperty.call(positions, keys[i])) {\n validateEventPosition(positions[keys[i]]);\n }\n }\n}\n\n/**\n * Determines whether a position is an EventPosition.\n * Does not validate that the position is allowed.\n * @internal\n */\nexport function isEventPosition(position: unknown): position is EventPosition {\n if (!position) {\n return false;\n }\n\n if (objectHasProperty(position, \"offset\") && isDefined(position.offset)) {\n return true;\n }\n\n if (objectHasProperty(position, \"sequenceNumber\") && isDefined(position.sequenceNumber)) {\n return true;\n }\n\n if (objectHasProperty(position, \"enqueuedOn\") && isDefined(position.enqueuedOn)) {\n return true;\n }\n\n return false;\n}\n\nfunction validateEventPosition(position: EventPosition): void {\n if (!isDefined(position)) {\n return;\n }\n const offsetPresent = isDefined(position.offset);\n const sequenceNumberPresent = isDefined(position.sequenceNumber);\n const enqueuedOnPresent = isDefined(position.enqueuedOn);\n\n if (\n (offsetPresent && sequenceNumberPresent) ||\n (offsetPresent && enqueuedOnPresent) ||\n (enqueuedOnPresent && sequenceNumberPresent)\n ) {\n throw new TypeError(\n \"Invalid value for EventPosition found. Set only one of offset, sequenceNumber or enqueuedOn properties.\",\n );\n }\n\n if (!offsetPresent && !enqueuedOnPresent && !sequenceNumberPresent) {\n throw new TypeError(\n \"Invalid value for EventPosition found. Pass an object with either of offset, sequenceNumber or enqueuedOn properties set.\",\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { Checkpoint } from "./partitionProcessor.js";
|
|
2
|
+
import type { PumpManager } from "./pumpManager.js";
|
|
3
|
+
import type { CommonEventProcessorOptions } from "./models/private.js";
|
|
4
|
+
import type { ConnectionContext } from "./connectionContext.js";
|
|
5
|
+
import type { OperationOptions } from "./util/operationOptions.js";
|
|
6
|
+
import type { SubscriptionEventHandlers } from "./eventHubConsumerClientModels.js";
|
|
7
|
+
/**
|
|
8
|
+
* An interface representing the details on which instance of a `EventProcessor` owns processing
|
|
9
|
+
* of a given partition from a consumer group of an Event Hub instance.
|
|
10
|
+
*
|
|
11
|
+
* **Note**: This is used internally by the `EventProcessor` and user never has to create it directly.
|
|
12
|
+
*/
|
|
13
|
+
export interface PartitionOwnership {
|
|
14
|
+
/**
|
|
15
|
+
* The fully qualified Event Hubs namespace. This is likely to be similar to
|
|
16
|
+
* <yournamespace>.servicebus.windows.net
|
|
17
|
+
*/
|
|
18
|
+
fullyQualifiedNamespace: string;
|
|
19
|
+
/**
|
|
20
|
+
* The event hub name
|
|
21
|
+
*/
|
|
22
|
+
eventHubName: string;
|
|
23
|
+
/**
|
|
24
|
+
* The consumer group name
|
|
25
|
+
*/
|
|
26
|
+
consumerGroup: string;
|
|
27
|
+
/**
|
|
28
|
+
* The identifier of the Event Hub partition.
|
|
29
|
+
*/
|
|
30
|
+
partitionId: string;
|
|
31
|
+
/**
|
|
32
|
+
* The unique identifier of the event processor.
|
|
33
|
+
*/
|
|
34
|
+
ownerId: string;
|
|
35
|
+
/**
|
|
36
|
+
* The last modified time.
|
|
37
|
+
*/
|
|
38
|
+
lastModifiedTimeInMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The unique identifier for the operation.
|
|
41
|
+
*/
|
|
42
|
+
etag?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A checkpoint store stores and retrieves partition ownership information and checkpoint details
|
|
46
|
+
* for each partition in a given consumer group of an event hub instance.
|
|
47
|
+
*
|
|
48
|
+
* Users are not meant to implement an `CheckpointStore`.
|
|
49
|
+
* Users are expected to choose existing implementations of this interface, instantiate it, and pass
|
|
50
|
+
* it to the `EventHubConsumerClient` class constructor when instantiating a client.
|
|
51
|
+
* Users are not expected to use any of the methods on a checkpoint store, these are used internally by
|
|
52
|
+
* the client.
|
|
53
|
+
*
|
|
54
|
+
* Implementations of `CheckpointStore` can be found on npm by searching for packages with the prefix @azure/eventhub-checkpointstore-.
|
|
55
|
+
*/
|
|
56
|
+
export interface CheckpointStore {
|
|
57
|
+
/**
|
|
58
|
+
* Called to get the list of all existing partition ownership from the underlying data store. Could return empty
|
|
59
|
+
* results if there are is no existing ownership information.
|
|
60
|
+
*
|
|
61
|
+
* @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to
|
|
62
|
+
* <yournamespace>.servicebus.windows.net.
|
|
63
|
+
* @param eventHubName - The event hub name.
|
|
64
|
+
* @param consumerGroup - The consumer group name.
|
|
65
|
+
* @param options - A set of options that can be specified to influence the behavior of this method.
|
|
66
|
+
* - `abortSignal`: A signal used to request operation cancellation.
|
|
67
|
+
* - `tracingOptions`: Options for configuring tracing.
|
|
68
|
+
* @returns A list of partition ownership details of all the partitions that have/had an owner.
|
|
69
|
+
*/
|
|
70
|
+
listOwnership(fullyQualifiedNamespace: string, eventHubName: string, consumerGroup: string, options?: OperationOptions): Promise<PartitionOwnership[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Called to claim ownership of a list of partitions. This will return the list of partitions that were owned
|
|
73
|
+
* successfully.
|
|
74
|
+
*
|
|
75
|
+
* @param partitionOwnership - The list of partition ownership this instance is claiming to own.
|
|
76
|
+
* @param options - A set of options that can be specified to influence the behavior of this method.
|
|
77
|
+
* - `abortSignal`: A signal used to request operation cancellation.
|
|
78
|
+
* - `tracingOptions`: Options for configuring tracing.
|
|
79
|
+
* @returns A list of partitions this instance successfully claimed ownership.
|
|
80
|
+
*/
|
|
81
|
+
claimOwnership(partitionOwnership: PartitionOwnership[], options?: OperationOptions): Promise<PartitionOwnership[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Updates the checkpoint in the data store for a partition.
|
|
84
|
+
*
|
|
85
|
+
* @param checkpoint - The checkpoint.
|
|
86
|
+
* @param options - A set of options that can be specified to influence the behavior of this method.
|
|
87
|
+
* - `abortSignal`: A signal used to request operation cancellation.
|
|
88
|
+
* - `tracingOptions`: Options for configuring tracing.
|
|
89
|
+
*/
|
|
90
|
+
updateCheckpoint(checkpoint: Checkpoint, options?: OperationOptions): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Lists all the checkpoints in a data store for a given namespace, eventhub and consumer group.
|
|
93
|
+
*
|
|
94
|
+
* @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to
|
|
95
|
+
* <yournamespace>.servicebus.windows.net.
|
|
96
|
+
* @param eventHubName - The event hub name.
|
|
97
|
+
* @param consumerGroup - The consumer group name.
|
|
98
|
+
* @param options - A set of options that can be specified to influence the behavior of this method.
|
|
99
|
+
* - `abortSignal`: A signal used to request operation cancellation.
|
|
100
|
+
* - `tracingOptions`: Options for configuring tracing.
|
|
101
|
+
* @returns A list of checkpoints for a given namespace, eventhub, and consumer group.
|
|
102
|
+
*/
|
|
103
|
+
listCheckpoints(fullyQualifiedNamespace: string, eventHubName: string, consumerGroup: string, options?: OperationOptions): Promise<Checkpoint[]>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A set of options to pass to the constructor of `EventProcessor`.
|
|
107
|
+
* You can specify
|
|
108
|
+
* - `maxBatchSize`: The max size of the batch of events passed each time to user code for processing.
|
|
109
|
+
* - `maxWaitTimeInSeconds`: The maximum amount of time to wait to build up the requested message count before
|
|
110
|
+
* passing the data to user code for processing. If not provided, it defaults to 60 seconds.
|
|
111
|
+
*
|
|
112
|
+
* Example usage with default values:
|
|
113
|
+
* ```ts snippet:ignore
|
|
114
|
+
* {
|
|
115
|
+
* maxBatchSize: 1,
|
|
116
|
+
* maxWaitTimeInSeconds: 60,
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
export interface FullEventProcessorOptions extends CommonEventProcessorOptions {
|
|
122
|
+
/**
|
|
123
|
+
* An optional pump manager to use, rather than instantiating one internally
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
pumpManager?: PumpManager;
|
|
127
|
+
/**
|
|
128
|
+
* The amount of time between load balancing attempts.
|
|
129
|
+
*/
|
|
130
|
+
loopIntervalInMs: number;
|
|
131
|
+
/**
|
|
132
|
+
* A specific partition to target.
|
|
133
|
+
*/
|
|
134
|
+
processingTarget?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Event Processor based applications consist of one or more instances of EventProcessor which have been
|
|
138
|
+
* configured to consume events from the same Event Hub and consumer group. They balance the
|
|
139
|
+
* workload across different instances by distributing the partitions to be processed among themselves.
|
|
140
|
+
* They also allow the user to track progress when events are processed using checkpoints.
|
|
141
|
+
*
|
|
142
|
+
* A checkpoint is meant to represent the last successfully processed event by the user from a particular
|
|
143
|
+
* partition of a consumer group in an Event Hub instance.
|
|
144
|
+
*
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export declare class EventProcessor {
|
|
148
|
+
private _consumerGroup;
|
|
149
|
+
private _context;
|
|
150
|
+
private _subscriptionEventHandlers;
|
|
151
|
+
private _checkpointStore;
|
|
152
|
+
private _processorOptions;
|
|
153
|
+
private _pumpManager;
|
|
154
|
+
private _id;
|
|
155
|
+
private _isRunning;
|
|
156
|
+
private _loopTask?;
|
|
157
|
+
private _abortController?;
|
|
158
|
+
/**
|
|
159
|
+
* A specific partition to target.
|
|
160
|
+
*/
|
|
161
|
+
private _processingTarget?;
|
|
162
|
+
/**
|
|
163
|
+
* Determines which partitions to claim as part of load balancing.
|
|
164
|
+
*/
|
|
165
|
+
private _loadBalancingStrategy;
|
|
166
|
+
/**
|
|
167
|
+
* The amount of time between load balancing attempts.
|
|
168
|
+
*/
|
|
169
|
+
private _loopIntervalInMs;
|
|
170
|
+
private _eventHubName;
|
|
171
|
+
private _fullyQualifiedNamespace;
|
|
172
|
+
/**
|
|
173
|
+
* @param consumerGroup - The name of the consumer group from which you want to process events.
|
|
174
|
+
* @param eventHubClient - An instance of `EventHubClient` that was created for the Event Hub instance.
|
|
175
|
+
* @param PartitionProcessorClass - A user-provided class that extends the `PartitionProcessor` class.
|
|
176
|
+
* This class will be responsible for processing and checkpointing events.
|
|
177
|
+
* @param checkpointStore - An instance of `CheckpointStore`. See @azure/eventhubs-checkpointstore-blob for an implementation.
|
|
178
|
+
* For production, choose an implementation that will store checkpoints and partition ownership details to a durable store.
|
|
179
|
+
* @param options - A set of options to configure the Event Processor
|
|
180
|
+
* - `maxBatchSize` : The max size of the batch of events passed each time to user code for processing.
|
|
181
|
+
* - `maxWaitTimeInSeconds` : The maximum amount of time to wait to build up the requested message count before
|
|
182
|
+
* passing the data to user code for processing. If not provided, it defaults to 60 seconds.
|
|
183
|
+
*/
|
|
184
|
+
constructor(_consumerGroup: string, _context: ConnectionContext, _subscriptionEventHandlers: SubscriptionEventHandlers, _checkpointStore: CheckpointStore, options: FullEventProcessorOptions);
|
|
185
|
+
/**
|
|
186
|
+
* The unique identifier for the EventProcessor.
|
|
187
|
+
*/
|
|
188
|
+
get id(): string;
|
|
189
|
+
private _createPartitionOwnershipRequest;
|
|
190
|
+
private _claimOwnership;
|
|
191
|
+
private _startPump;
|
|
192
|
+
private _getStartingPosition;
|
|
193
|
+
private _runLoopForSinglePartition;
|
|
194
|
+
/**
|
|
195
|
+
* Every loop to this method will result in this EventProcessor owning at most one new partition.
|
|
196
|
+
*
|
|
197
|
+
* The load is considered balanced when no active EventProcessor owns 2 partitions more than any other active
|
|
198
|
+
* EventProcessor. Given that each invocation to this method results in ownership claim of at most one partition,
|
|
199
|
+
* this algorithm converges gradually towards a steady state.
|
|
200
|
+
*
|
|
201
|
+
* When a new partition is claimed, this method is also responsible for starting a partition pump that creates an
|
|
202
|
+
* EventHubConsumer for processing events from that partition.
|
|
203
|
+
*/
|
|
204
|
+
private _runLoopWithLoadBalancing;
|
|
205
|
+
private _performLoadBalancing;
|
|
206
|
+
/**
|
|
207
|
+
* This is called when there are errors that are not specific to a partition (ex: load balancing)
|
|
208
|
+
*/
|
|
209
|
+
private _handleSubscriptionError;
|
|
210
|
+
/**
|
|
211
|
+
* Starts the `EventProcessor`. Based on the number of instances of `EventProcessor` that are running for the
|
|
212
|
+
* same consumer group, the partitions are distributed among these instances to process events.
|
|
213
|
+
*
|
|
214
|
+
* For each partition, the user provided `PartitionProcessor` is instantiated.
|
|
215
|
+
*
|
|
216
|
+
* Subsequent calls to start will be ignored if this event processor is already running.
|
|
217
|
+
* Calling `start()` after `stop()` is called will restart this event processor.
|
|
218
|
+
*
|
|
219
|
+
*/
|
|
220
|
+
start(): void;
|
|
221
|
+
isRunning(): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Stops processing events for all partitions owned by this event processor.
|
|
224
|
+
* All `PartitionProcessor` will be shutdown and any open resources will be closed.
|
|
225
|
+
*
|
|
226
|
+
* Subsequent calls to stop will be ignored if the event processor is not running.
|
|
227
|
+
*
|
|
228
|
+
*/
|
|
229
|
+
stop(): Promise<void>;
|
|
230
|
+
private abandonPartitionOwnerships;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=eventProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventProcessor.d.ts","sourceRoot":"","sources":["../../src/eventProcessor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAKnF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;OAYG;IACH,aAAa,CACX,uBAAuB,EAAE,MAAM,EAC/B,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,OAA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