@azure/event-hubs 5.12.1-alpha.20240605.1 → 5.12.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/README.md +1 -1
- package/dist/browser/batchingPartitionChannel.d.ts +94 -0
- package/dist/browser/batchingPartitionChannel.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/batchingPartitionChannel.js +4 -4
- package/dist/browser/batchingPartitionChannel.js.map +1 -0
- package/dist/browser/connectionContext.d.ts +107 -0
- package/dist/browser/connectionContext.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/connectionContext.js +8 -8
- package/dist/browser/connectionContext.js.map +1 -0
- package/dist/browser/dataTransformer.d.ts +53 -0
- package/dist/browser/dataTransformer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/dataTransformer.js +2 -2
- package/dist/browser/dataTransformer.js.map +1 -0
- package/dist/browser/diagnostics/instrumentEventData.d.ts +28 -0
- package/dist/browser/diagnostics/instrumentEventData.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/diagnostics/instrumentEventData.js +3 -3
- package/dist/browser/diagnostics/instrumentEventData.js.map +1 -0
- package/dist/browser/diagnostics/tracing.d.ts +19 -0
- package/dist/browser/diagnostics/tracing.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/diagnostics/tracing.js +2 -2
- package/dist/browser/diagnostics/tracing.js.map +1 -0
- package/dist/browser/eventData.d.ts +295 -0
- package/dist/browser/eventData.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventData.js +38 -4
- package/dist/browser/eventData.js.map +1 -0
- package/dist/browser/eventDataAdapter.d.ts +69 -0
- package/dist/browser/eventDataAdapter.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventDataAdapter.js +1 -1
- package/dist/browser/eventDataAdapter.js.map +1 -0
- package/dist/browser/eventDataBatch.d.ts +225 -0
- package/dist/browser/eventDataBatch.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventDataBatch.js +7 -4
- package/dist/browser/eventDataBatch.js.map +1 -0
- package/dist/browser/eventHubBufferedProducerClient.d.ts +323 -0
- package/dist/browser/eventHubBufferedProducerClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventHubBufferedProducerClient.js +10 -9
- package/dist/browser/eventHubBufferedProducerClient.js.map +1 -0
- package/dist/browser/eventHubConsumerClient.d.ts +277 -0
- package/dist/browser/eventHubConsumerClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventHubConsumerClient.js +12 -12
- package/dist/browser/eventHubConsumerClient.js.map +1 -0
- package/dist/browser/eventHubConsumerClientModels.d.ts +218 -0
- package/dist/browser/eventHubConsumerClientModels.d.ts.map +1 -0
- package/dist/browser/eventHubConsumerClientModels.js +4 -0
- package/dist/browser/eventHubConsumerClientModels.js.map +1 -0
- package/dist/browser/eventHubProducerClient.d.ts +266 -0
- package/dist/browser/eventHubProducerClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventHubProducerClient.js +12 -10
- package/dist/browser/eventHubProducerClient.js.map +1 -0
- package/dist/browser/eventHubSender.d.ts +227 -0
- package/dist/browser/eventHubSender.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventHubSender.js +11 -10
- package/dist/browser/eventHubSender.js.map +1 -0
- package/dist/browser/eventPosition.d.ts +73 -0
- package/dist/browser/eventPosition.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventPosition.js +1 -1
- package/{dist-esm/src → dist/browser}/eventPosition.js.map +1 -1
- package/dist/browser/eventProcessor.d.ts +232 -0
- package/dist/browser/eventProcessor.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventProcessor.js +18 -18
- package/dist/browser/eventProcessor.js.map +1 -0
- package/dist/browser/eventhubConnectionConfig.d.ts +96 -0
- package/dist/browser/eventhubConnectionConfig.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/eventhubConnectionConfig.js +2 -2
- package/dist/browser/eventhubConnectionConfig.js.map +1 -0
- package/dist/browser/impl/awaitableQueue.d.ts +25 -0
- package/dist/browser/impl/awaitableQueue.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/impl/awaitableQueue.js +1 -1
- package/{dist-esm/src → dist/browser}/impl/awaitableQueue.js.map +1 -1
- package/dist/browser/impl/partitionAssigner.d.ts +29 -0
- package/dist/browser/impl/partitionAssigner.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/impl/partitionAssigner.js +2 -2
- package/dist/browser/impl/partitionAssigner.js.map +1 -0
- package/dist/browser/impl/partitionGate.d.ts +27 -0
- package/dist/browser/impl/partitionGate.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/impl/partitionGate.js +1 -1
- package/{dist-esm/src → dist/browser}/impl/partitionGate.js.map +1 -1
- package/dist/browser/impl/partitionKeyToIdMapper.d.ts +6 -0
- package/dist/browser/impl/partitionKeyToIdMapper.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/impl/partitionKeyToIdMapper.js +1 -1
- package/{dist-esm/src → dist/browser}/impl/partitionKeyToIdMapper.js.map +1 -1
- package/dist/browser/inMemoryCheckpointStore.d.ts +44 -0
- package/dist/browser/inMemoryCheckpointStore.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/inMemoryCheckpointStore.js +3 -3
- package/dist/browser/inMemoryCheckpointStore.js.map +1 -0
- package/dist/browser/index.d.ts +21 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/index.js +9 -9
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
- package/dist/browser/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/loadBalancerStrategies/balancedStrategy.js +2 -2
- package/dist/browser/loadBalancerStrategies/balancedStrategy.js.map +1 -0
- package/dist/browser/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
- package/dist/browser/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/loadBalancerStrategies/greedyStrategy.js +2 -2
- package/dist/browser/loadBalancerStrategies/greedyStrategy.js.map +1 -0
- package/dist/browser/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
- package/dist/browser/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/loadBalancerStrategies/loadBalancingStrategy.js +2 -2
- package/dist/browser/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
- package/dist/browser/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
- package/dist/browser/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/loadBalancerStrategies/unbalancedStrategy.js +1 -1
- package/dist/browser/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
- package/dist/browser/logger.d.ts +37 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/logger.js +1 -1
- package/{dist-esm/src → dist/browser}/logger.js.map +1 -1
- package/dist/browser/managementClient.d.ts +141 -0
- package/dist/browser/managementClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/managementClient.js +7 -7
- package/dist/browser/managementClient.js.map +1 -0
- package/dist/browser/models/private.d.ts +185 -0
- package/dist/browser/models/private.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/private.js +2 -2
- package/dist/browser/models/private.js.map +1 -0
- package/dist/browser/models/public.d.ts +240 -0
- package/dist/browser/models/public.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/public.js +1 -1
- package/dist/browser/models/public.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/partitionProcessor.d.ts +134 -0
- package/dist/browser/partitionProcessor.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/partitionProcessor.js +2 -2
- package/dist/browser/partitionProcessor.js.map +1 -0
- package/dist/browser/partitionPump.d.ts +38 -0
- package/dist/browser/partitionPump.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/partitionPump.js +6 -7
- package/dist/browser/partitionPump.js.map +1 -0
- package/dist/browser/partitionReceiver.d.ts +82 -0
- package/dist/browser/partitionReceiver.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/partitionReceiver.js +15 -12
- package/dist/browser/partitionReceiver.js.map +1 -0
- package/dist/browser/pumpManager.d.ts +72 -0
- package/dist/browser/pumpManager.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/pumpManager.js +4 -4
- package/dist/browser/pumpManager.js.map +1 -0
- package/dist/browser/util/connectionStringUtils.d.ts +52 -0
- package/dist/browser/util/connectionStringUtils.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/connectionStringUtils.js +1 -1
- package/{dist-esm/src → dist/browser}/util/connectionStringUtils.js.map +1 -1
- package/dist/browser/util/constants.d.ts +23 -0
- package/dist/browser/util/constants.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/constants.js +1 -1
- package/{dist-esm/src → dist/browser}/util/constants.js.map +1 -1
- package/dist/browser/util/delayWithoutThrow.d.ts +8 -0
- package/dist/browser/util/delayWithoutThrow.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/delayWithoutThrow.js +1 -1
- package/{dist-esm/src → dist/browser}/util/delayWithoutThrow.js.map +1 -1
- package/dist/browser/util/error.d.ts +39 -0
- package/dist/browser/util/error.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/error.js +2 -2
- package/dist/browser/util/error.js.map +1 -0
- package/dist/browser/util/getPromiseParts.d.ts +10 -0
- package/dist/browser/util/getPromiseParts.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/getPromiseParts.js +1 -1
- package/{dist-esm/src → dist/browser}/util/getPromiseParts.js.map +1 -1
- package/dist/browser/util/operationOptions.d.ts +16 -0
- package/dist/browser/util/operationOptions.d.ts.map +1 -0
- package/dist/browser/util/operationOptions.js +4 -0
- package/{dist-esm/src → dist/browser}/util/operationOptions.js.map +1 -1
- package/dist/browser/util/parseEndpoint.d.ts +11 -0
- package/dist/browser/util/parseEndpoint.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/parseEndpoint.js +1 -1
- package/{dist-esm/src → dist/browser}/util/parseEndpoint.js.map +1 -1
- package/dist/browser/util/retries.d.ts +6 -0
- package/dist/browser/util/retries.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/retries.js +1 -1
- package/{dist-esm/src → dist/browser}/util/retries.js.map +1 -1
- package/dist/browser/util/runtimeInfo-browser.d.mts.map +1 -0
- package/dist/browser/util/runtimeInfo-browser.mjs.map +1 -0
- package/dist/browser/util/runtimeInfo.d.ts +6 -0
- package/{dist-esm/src/util/runtimeInfo.browser.js → dist/browser/util/runtimeInfo.js} +2 -2
- package/dist/browser/util/timerLoop.d.ts +26 -0
- package/dist/browser/util/timerLoop.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/timerLoop.js +1 -1
- package/{dist-esm/src → dist/browser}/util/timerLoop.js.map +1 -1
- package/dist/browser/util/typeGuards.d.ts +8 -0
- package/dist/browser/util/typeGuards.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/typeGuards.js +1 -1
- package/{dist-esm/src → dist/browser}/util/typeGuards.js.map +1 -1
- package/dist/browser/util/utils.d.ts +7 -0
- package/dist/browser/util/utils.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/utils.js +1 -1
- package/{dist-esm/src → dist/browser}/util/utils.js.map +1 -1
- package/dist/browser/withAuth.d.ts +25 -0
- package/dist/browser/withAuth.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/withAuth.js +3 -3
- package/dist/browser/withAuth.js.map +1 -0
- package/dist/commonjs/batchingPartitionChannel.d.ts +94 -0
- package/dist/commonjs/batchingPartitionChannel.d.ts.map +1 -0
- package/dist/commonjs/batchingPartitionChannel.js +252 -0
- package/dist/commonjs/batchingPartitionChannel.js.map +1 -0
- package/dist/commonjs/connectionContext.d.ts +107 -0
- package/dist/commonjs/connectionContext.d.ts.map +1 -0
- package/dist/commonjs/connectionContext.js +324 -0
- package/dist/commonjs/connectionContext.js.map +1 -0
- package/dist/commonjs/dataTransformer.d.ts +53 -0
- package/dist/commonjs/dataTransformer.d.ts.map +1 -0
- package/dist/commonjs/dataTransformer.js +138 -0
- package/dist/commonjs/dataTransformer.js.map +1 -0
- package/dist/commonjs/diagnostics/instrumentEventData.d.ts +28 -0
- package/dist/commonjs/diagnostics/instrumentEventData.d.ts.map +1 -0
- package/dist/commonjs/diagnostics/instrumentEventData.js +73 -0
- package/dist/commonjs/diagnostics/instrumentEventData.js.map +1 -0
- package/dist/commonjs/diagnostics/tracing.d.ts +19 -0
- package/dist/commonjs/diagnostics/tracing.d.ts.map +1 -0
- package/dist/commonjs/diagnostics/tracing.js +44 -0
- package/dist/commonjs/diagnostics/tracing.js.map +1 -0
- package/dist/commonjs/eventData.d.ts +295 -0
- package/dist/commonjs/eventData.d.ts.map +1 -0
- package/dist/commonjs/eventData.js +253 -0
- package/dist/commonjs/eventData.js.map +1 -0
- package/dist/commonjs/eventDataAdapter.d.ts +69 -0
- package/dist/commonjs/eventDataAdapter.d.ts.map +1 -0
- package/dist/commonjs/eventDataAdapter.js +38 -0
- package/dist/commonjs/eventDataAdapter.js.map +1 -0
- package/dist/commonjs/eventDataBatch.d.ts +225 -0
- package/dist/commonjs/eventDataBatch.d.ts.map +1 -0
- package/dist/commonjs/eventDataBatch.js +254 -0
- package/dist/commonjs/eventDataBatch.js.map +1 -0
- package/dist/commonjs/eventHubBufferedProducerClient.d.ts +323 -0
- package/dist/commonjs/eventHubBufferedProducerClient.d.ts.map +1 -0
- package/dist/commonjs/eventHubBufferedProducerClient.js +289 -0
- package/dist/commonjs/eventHubBufferedProducerClient.js.map +1 -0
- package/dist/commonjs/eventHubConsumerClient.d.ts +277 -0
- package/dist/commonjs/eventHubConsumerClient.d.ts.map +1 -0
- package/dist/commonjs/eventHubConsumerClient.js +298 -0
- package/dist/commonjs/eventHubConsumerClient.js.map +1 -0
- package/dist/commonjs/eventHubConsumerClientModels.d.ts +218 -0
- package/dist/commonjs/eventHubConsumerClientModels.d.ts.map +1 -0
- package/dist/commonjs/eventHubConsumerClientModels.js +5 -0
- package/dist/commonjs/eventHubConsumerClientModels.js.map +1 -0
- package/dist/commonjs/eventHubProducerClient.d.ts +266 -0
- package/dist/commonjs/eventHubProducerClient.d.ts.map +1 -0
- package/dist/commonjs/eventHubProducerClient.js +319 -0
- package/dist/commonjs/eventHubProducerClient.js.map +1 -0
- package/dist/commonjs/eventHubSender.d.ts +227 -0
- package/dist/commonjs/eventHubSender.d.ts.map +1 -0
- package/dist/commonjs/eventHubSender.js +547 -0
- package/dist/commonjs/eventHubSender.js.map +1 -0
- package/dist/commonjs/eventPosition.d.ts +73 -0
- package/dist/commonjs/eventPosition.d.ts.map +1 -0
- package/dist/commonjs/eventPosition.js +128 -0
- package/dist/commonjs/eventPosition.js.map +1 -0
- package/dist/commonjs/eventProcessor.d.ts +232 -0
- package/dist/commonjs/eventProcessor.d.ts.map +1 -0
- package/dist/commonjs/eventProcessor.js +371 -0
- package/dist/commonjs/eventProcessor.js.map +1 -0
- package/dist/commonjs/eventhubConnectionConfig.d.ts +96 -0
- package/dist/commonjs/eventhubConnectionConfig.d.ts.map +1 -0
- package/dist/commonjs/eventhubConnectionConfig.js +101 -0
- package/dist/commonjs/eventhubConnectionConfig.js.map +1 -0
- package/dist/commonjs/impl/awaitableQueue.d.ts +25 -0
- package/dist/commonjs/impl/awaitableQueue.d.ts.map +1 -0
- package/dist/commonjs/impl/awaitableQueue.js +51 -0
- package/dist/commonjs/impl/awaitableQueue.js.map +1 -0
- package/dist/commonjs/impl/partitionAssigner.d.ts +29 -0
- package/dist/commonjs/impl/partitionAssigner.d.ts.map +1 -0
- package/dist/commonjs/impl/partitionAssigner.js +58 -0
- package/dist/commonjs/impl/partitionAssigner.js.map +1 -0
- package/dist/commonjs/impl/partitionGate.d.ts +27 -0
- package/dist/commonjs/impl/partitionGate.d.ts.map +1 -0
- package/dist/commonjs/impl/partitionGate.js +44 -0
- package/dist/commonjs/impl/partitionGate.js.map +1 -0
- package/dist/commonjs/impl/partitionKeyToIdMapper.d.ts +6 -0
- package/dist/commonjs/impl/partitionKeyToIdMapper.d.ts.map +1 -0
- package/dist/commonjs/impl/partitionKeyToIdMapper.js +115 -0
- package/dist/commonjs/impl/partitionKeyToIdMapper.js.map +1 -0
- package/dist/commonjs/inMemoryCheckpointStore.d.ts +44 -0
- package/dist/commonjs/inMemoryCheckpointStore.d.ts.map +1 -0
- package/dist/commonjs/inMemoryCheckpointStore.js +96 -0
- package/dist/commonjs/inMemoryCheckpointStore.js.map +1 -0
- package/dist/commonjs/index.d.ts +21 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +26 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
- package/dist/commonjs/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/balancedStrategy.js +43 -0
- package/dist/commonjs/loadBalancerStrategies/balancedStrategy.js.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
- package/dist/commonjs/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/greedyStrategy.js +32 -0
- package/dist/commonjs/loadBalancerStrategies/greedyStrategy.js.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
- package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.js +248 -0
- package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
- package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
- package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.js +26 -0
- package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
- package/dist/commonjs/logger.d.ts +37 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +65 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/managementClient.d.ts +141 -0
- package/dist/commonjs/managementClient.d.ts.map +1 -0
- package/dist/commonjs/managementClient.js +274 -0
- package/dist/commonjs/managementClient.js.map +1 -0
- package/dist/commonjs/models/private.d.ts +185 -0
- package/dist/commonjs/models/private.d.ts.map +1 -0
- package/dist/commonjs/models/private.js +6 -0
- package/dist/commonjs/models/private.js.map +1 -0
- package/dist/commonjs/models/public.d.ts +240 -0
- package/dist/commonjs/models/public.d.ts.map +1 -0
- package/dist/commonjs/models/public.js +21 -0
- package/dist/commonjs/models/public.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/partitionProcessor.d.ts +134 -0
- package/dist/commonjs/partitionProcessor.d.ts.map +1 -0
- package/dist/commonjs/partitionProcessor.js +138 -0
- package/dist/commonjs/partitionProcessor.js.map +1 -0
- package/dist/commonjs/partitionPump.d.ts +38 -0
- package/dist/commonjs/partitionPump.d.ts.map +1 -0
- package/dist/commonjs/partitionPump.js +171 -0
- package/dist/commonjs/partitionPump.js.map +1 -0
- package/dist/commonjs/partitionReceiver.d.ts +82 -0
- package/dist/commonjs/partitionReceiver.d.ts.map +1 -0
- package/dist/commonjs/partitionReceiver.js +335 -0
- package/dist/commonjs/partitionReceiver.js.map +1 -0
- package/dist/commonjs/pumpManager.d.ts +72 -0
- package/dist/commonjs/pumpManager.d.ts.map +1 -0
- package/dist/commonjs/pumpManager.js +122 -0
- package/dist/commonjs/pumpManager.js.map +1 -0
- package/{types/latest → dist/commonjs}/tsdoc-metadata.json +1 -1
- package/dist/commonjs/util/connectionStringUtils.d.ts +52 -0
- package/dist/commonjs/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/commonjs/util/connectionStringUtils.js +51 -0
- package/dist/commonjs/util/connectionStringUtils.js.map +1 -0
- package/dist/commonjs/util/constants.d.ts +23 -0
- package/dist/commonjs/util/constants.d.ts.map +1 -0
- package/dist/commonjs/util/constants.js +28 -0
- package/dist/commonjs/util/constants.js.map +1 -0
- package/dist/commonjs/util/delayWithoutThrow.d.ts +8 -0
- package/dist/commonjs/util/delayWithoutThrow.d.ts.map +1 -0
- package/dist/commonjs/util/delayWithoutThrow.js +20 -0
- package/dist/commonjs/util/delayWithoutThrow.js.map +1 -0
- package/dist/commonjs/util/error.d.ts +39 -0
- package/dist/commonjs/util/error.d.ts.map +1 -0
- package/dist/commonjs/util/error.js +110 -0
- package/dist/commonjs/util/error.js.map +1 -0
- package/dist/commonjs/util/getPromiseParts.d.ts +10 -0
- package/dist/commonjs/util/getPromiseParts.d.ts.map +1 -0
- package/dist/commonjs/util/getPromiseParts.js +23 -0
- package/dist/commonjs/util/getPromiseParts.js.map +1 -0
- package/dist/commonjs/util/operationOptions.d.ts +16 -0
- package/dist/commonjs/util/operationOptions.d.ts.map +1 -0
- package/dist/commonjs/util/operationOptions.js +5 -0
- package/dist/commonjs/util/operationOptions.js.map +1 -0
- package/dist/commonjs/util/parseEndpoint.d.ts +11 -0
- package/dist/commonjs/util/parseEndpoint.d.ts.map +1 -0
- package/dist/commonjs/util/parseEndpoint.js +20 -0
- package/dist/commonjs/util/parseEndpoint.js.map +1 -0
- package/dist/commonjs/util/retries.d.ts +6 -0
- package/dist/commonjs/util/retries.d.ts.map +1 -0
- package/dist/commonjs/util/retries.js +16 -0
- package/dist/commonjs/util/retries.js.map +1 -0
- package/dist/commonjs/util/runtimeInfo.d.ts +6 -0
- package/dist/commonjs/util/runtimeInfo.d.ts.map +1 -0
- package/dist/commonjs/util/runtimeInfo.js +15 -0
- package/dist/commonjs/util/runtimeInfo.js.map +1 -0
- package/dist/commonjs/util/timerLoop.d.ts +26 -0
- package/dist/commonjs/util/timerLoop.d.ts.map +1 -0
- package/dist/commonjs/util/timerLoop.js +30 -0
- package/dist/commonjs/util/timerLoop.js.map +1 -0
- package/dist/commonjs/util/typeGuards.d.ts +8 -0
- package/dist/commonjs/util/typeGuards.d.ts.map +1 -0
- package/dist/commonjs/util/typeGuards.js +15 -0
- package/dist/commonjs/util/typeGuards.js.map +1 -0
- package/dist/commonjs/util/utils.d.ts +7 -0
- package/dist/commonjs/util/utils.d.ts.map +1 -0
- package/dist/commonjs/util/utils.js +16 -0
- package/dist/commonjs/util/utils.js.map +1 -0
- package/dist/commonjs/withAuth.d.ts +25 -0
- package/dist/commonjs/withAuth.d.ts.map +1 -0
- package/dist/commonjs/withAuth.js +88 -0
- package/dist/commonjs/withAuth.js.map +1 -0
- package/dist/esm/batchingPartitionChannel.d.ts +94 -0
- package/dist/esm/batchingPartitionChannel.d.ts.map +1 -0
- package/dist/esm/batchingPartitionChannel.js +248 -0
- package/dist/esm/batchingPartitionChannel.js.map +1 -0
- package/dist/esm/connectionContext.d.ts +107 -0
- package/dist/esm/connectionContext.d.ts.map +1 -0
- package/dist/esm/connectionContext.js +320 -0
- package/dist/esm/connectionContext.js.map +1 -0
- package/dist/esm/dataTransformer.d.ts +53 -0
- package/dist/esm/dataTransformer.d.ts.map +1 -0
- package/dist/esm/dataTransformer.js +133 -0
- package/dist/esm/dataTransformer.js.map +1 -0
- package/dist/esm/diagnostics/instrumentEventData.d.ts +28 -0
- package/dist/esm/diagnostics/instrumentEventData.d.ts.map +1 -0
- package/dist/esm/diagnostics/instrumentEventData.js +68 -0
- package/dist/esm/diagnostics/instrumentEventData.js.map +1 -0
- package/dist/esm/diagnostics/tracing.d.ts +19 -0
- package/dist/esm/diagnostics/tracing.d.ts.map +1 -0
- package/dist/esm/diagnostics/tracing.js +40 -0
- package/dist/esm/diagnostics/tracing.js.map +1 -0
- package/dist/esm/eventData.d.ts +295 -0
- package/dist/esm/eventData.d.ts.map +1 -0
- package/dist/esm/eventData.js +245 -0
- package/dist/esm/eventData.js.map +1 -0
- package/dist/esm/eventDataAdapter.d.ts +69 -0
- package/dist/esm/eventDataAdapter.d.ts.map +1 -0
- package/dist/esm/eventDataAdapter.js +35 -0
- package/dist/esm/eventDataAdapter.js.map +1 -0
- package/dist/esm/eventDataBatch.d.ts +225 -0
- package/dist/esm/eventDataBatch.d.ts.map +1 -0
- package/dist/esm/eventDataBatch.js +249 -0
- package/dist/esm/eventDataBatch.js.map +1 -0
- package/dist/esm/eventHubBufferedProducerClient.d.ts +323 -0
- package/dist/esm/eventHubBufferedProducerClient.d.ts.map +1 -0
- package/dist/esm/eventHubBufferedProducerClient.js +285 -0
- package/dist/esm/eventHubBufferedProducerClient.js.map +1 -0
- package/dist/esm/eventHubConsumerClient.d.ts +277 -0
- package/dist/esm/eventHubConsumerClient.d.ts.map +1 -0
- package/dist/esm/eventHubConsumerClient.js +293 -0
- package/dist/esm/eventHubConsumerClient.js.map +1 -0
- package/dist/esm/eventHubConsumerClientModels.d.ts +218 -0
- package/dist/esm/eventHubConsumerClientModels.d.ts.map +1 -0
- package/dist/esm/eventHubConsumerClientModels.js +4 -0
- package/dist/esm/eventHubConsumerClientModels.js.map +1 -0
- package/dist/esm/eventHubProducerClient.d.ts +266 -0
- package/dist/esm/eventHubProducerClient.d.ts.map +1 -0
- package/dist/esm/eventHubProducerClient.js +315 -0
- package/dist/esm/eventHubProducerClient.js.map +1 -0
- package/dist/esm/eventHubSender.d.ts +227 -0
- package/dist/esm/eventHubSender.d.ts.map +1 -0
- package/dist/esm/eventHubSender.js +541 -0
- package/dist/esm/eventHubSender.js.map +1 -0
- package/dist/esm/eventPosition.d.ts +73 -0
- package/dist/esm/eventPosition.d.ts.map +1 -0
- package/dist/esm/eventPosition.js +121 -0
- package/dist/esm/eventPosition.js.map +1 -0
- package/dist/esm/eventProcessor.d.ts +232 -0
- package/dist/esm/eventProcessor.d.ts.map +1 -0
- package/dist/esm/eventProcessor.js +367 -0
- package/dist/esm/eventProcessor.js.map +1 -0
- package/dist/esm/eventhubConnectionConfig.d.ts +96 -0
- package/dist/esm/eventhubConnectionConfig.d.ts.map +1 -0
- package/dist/esm/eventhubConnectionConfig.js +98 -0
- package/dist/esm/eventhubConnectionConfig.js.map +1 -0
- package/dist/esm/impl/awaitableQueue.d.ts +25 -0
- package/dist/esm/impl/awaitableQueue.d.ts.map +1 -0
- package/dist/esm/impl/awaitableQueue.js +47 -0
- package/dist/esm/impl/awaitableQueue.js.map +1 -0
- package/dist/esm/impl/partitionAssigner.d.ts +29 -0
- package/dist/esm/impl/partitionAssigner.d.ts.map +1 -0
- package/dist/esm/impl/partitionAssigner.js +54 -0
- package/dist/esm/impl/partitionAssigner.js.map +1 -0
- package/dist/esm/impl/partitionGate.d.ts +27 -0
- package/dist/esm/impl/partitionGate.d.ts.map +1 -0
- package/dist/esm/impl/partitionGate.js +40 -0
- package/dist/esm/impl/partitionGate.js.map +1 -0
- package/dist/esm/impl/partitionKeyToIdMapper.d.ts +6 -0
- package/dist/esm/impl/partitionKeyToIdMapper.d.ts.map +1 -0
- package/dist/esm/impl/partitionKeyToIdMapper.js +111 -0
- package/dist/esm/impl/partitionKeyToIdMapper.js.map +1 -0
- package/dist/esm/inMemoryCheckpointStore.d.ts +44 -0
- package/dist/esm/inMemoryCheckpointStore.d.ts.map +1 -0
- package/dist/esm/inMemoryCheckpointStore.js +92 -0
- package/dist/esm/inMemoryCheckpointStore.js.map +1 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
- package/dist/esm/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
- package/dist/esm/loadBalancerStrategies/balancedStrategy.js +39 -0
- package/dist/esm/loadBalancerStrategies/balancedStrategy.js.map +1 -0
- package/dist/esm/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
- package/dist/esm/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
- package/dist/esm/loadBalancerStrategies/greedyStrategy.js +28 -0
- package/dist/esm/loadBalancerStrategies/greedyStrategy.js.map +1 -0
- package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
- package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
- package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.js +245 -0
- package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
- package/dist/esm/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
- package/dist/esm/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
- package/dist/esm/loadBalancerStrategies/unbalancedStrategy.js +22 -0
- package/dist/esm/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
- package/dist/esm/logger.d.ts +37 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +56 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/managementClient.d.ts +141 -0
- package/dist/esm/managementClient.d.ts.map +1 -0
- package/dist/esm/managementClient.js +270 -0
- package/dist/esm/managementClient.js.map +1 -0
- package/dist/esm/models/private.d.ts +185 -0
- package/dist/esm/models/private.d.ts.map +1 -0
- package/dist/esm/models/private.js +4 -0
- package/dist/esm/models/private.js.map +1 -0
- package/dist/esm/models/public.d.ts +240 -0
- package/dist/esm/models/public.d.ts.map +1 -0
- package/dist/esm/models/public.js +18 -0
- package/dist/esm/models/public.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/partitionProcessor.d.ts +134 -0
- package/dist/esm/partitionProcessor.d.ts.map +1 -0
- package/dist/esm/partitionProcessor.js +134 -0
- package/dist/esm/partitionProcessor.js.map +1 -0
- package/dist/esm/partitionPump.d.ts +38 -0
- package/dist/esm/partitionPump.d.ts.map +1 -0
- package/dist/esm/partitionPump.js +166 -0
- package/dist/esm/partitionPump.js.map +1 -0
- package/dist/esm/partitionReceiver.d.ts +82 -0
- package/dist/esm/partitionReceiver.d.ts.map +1 -0
- package/dist/esm/partitionReceiver.js +330 -0
- package/dist/esm/partitionReceiver.js.map +1 -0
- package/dist/esm/pumpManager.d.ts +72 -0
- package/dist/esm/pumpManager.d.ts.map +1 -0
- package/dist/esm/pumpManager.js +118 -0
- package/dist/esm/pumpManager.js.map +1 -0
- package/dist/esm/util/connectionStringUtils.d.ts +52 -0
- package/dist/esm/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/esm/util/connectionStringUtils.js +48 -0
- package/dist/esm/util/connectionStringUtils.js.map +1 -0
- package/dist/esm/util/constants.d.ts +23 -0
- package/dist/esm/util/constants.d.ts.map +1 -0
- package/dist/esm/util/constants.js +25 -0
- package/dist/esm/util/constants.js.map +1 -0
- package/dist/esm/util/delayWithoutThrow.d.ts +8 -0
- package/dist/esm/util/delayWithoutThrow.d.ts.map +1 -0
- package/dist/esm/util/delayWithoutThrow.js +17 -0
- package/dist/esm/util/delayWithoutThrow.js.map +1 -0
- package/dist/esm/util/error.d.ts +39 -0
- package/dist/esm/util/error.d.ts.map +1 -0
- package/dist/esm/util/error.js +103 -0
- package/dist/esm/util/error.js.map +1 -0
- package/dist/esm/util/getPromiseParts.d.ts +10 -0
- package/dist/esm/util/getPromiseParts.d.ts.map +1 -0
- package/dist/esm/util/getPromiseParts.js +20 -0
- package/dist/esm/util/getPromiseParts.js.map +1 -0
- package/dist/esm/util/operationOptions.d.ts +16 -0
- package/dist/esm/util/operationOptions.d.ts.map +1 -0
- package/dist/esm/util/operationOptions.js +4 -0
- package/dist/esm/util/operationOptions.js.map +1 -0
- package/dist/esm/util/parseEndpoint.d.ts +11 -0
- package/dist/esm/util/parseEndpoint.d.ts.map +1 -0
- package/dist/esm/util/parseEndpoint.js +17 -0
- package/dist/esm/util/parseEndpoint.js.map +1 -0
- package/dist/esm/util/retries.d.ts +6 -0
- package/dist/esm/util/retries.d.ts.map +1 -0
- package/dist/esm/util/retries.js +13 -0
- package/dist/esm/util/retries.js.map +1 -0
- package/dist/esm/util/runtimeInfo.d.ts +6 -0
- package/dist/esm/util/runtimeInfo.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/util/runtimeInfo.js +1 -1
- package/{dist-esm/src → dist/esm}/util/runtimeInfo.js.map +1 -1
- package/dist/esm/util/timerLoop.d.ts +26 -0
- package/dist/esm/util/timerLoop.d.ts.map +1 -0
- package/dist/esm/util/timerLoop.js +27 -0
- package/dist/esm/util/timerLoop.js.map +1 -0
- package/dist/esm/util/typeGuards.d.ts +8 -0
- package/dist/esm/util/typeGuards.d.ts.map +1 -0
- package/dist/esm/util/typeGuards.js +12 -0
- package/dist/esm/util/typeGuards.js.map +1 -0
- package/dist/esm/util/utils.d.ts +7 -0
- package/dist/esm/util/utils.d.ts.map +1 -0
- package/dist/esm/util/utils.js +13 -0
- package/dist/esm/util/utils.js.map +1 -0
- package/dist/esm/withAuth.d.ts +25 -0
- package/dist/esm/withAuth.d.ts.map +1 -0
- package/dist/esm/withAuth.js +84 -0
- package/dist/esm/withAuth.js.map +1 -0
- package/{types/latest → dist}/event-hubs.d.ts +1 -3
- package/package.json +84 -76
- package/dist/index.js +0 -5369
- package/dist/index.js.map +0 -1
- package/dist-esm/src/batchingPartitionChannel.js.map +0 -1
- package/dist-esm/src/connectionContext.js.map +0 -1
- package/dist-esm/src/dataTransformer.js.map +0 -1
- package/dist-esm/src/diagnostics/instrumentEventData.js.map +0 -1
- package/dist-esm/src/diagnostics/tracing.js.map +0 -1
- package/dist-esm/src/eventData.js.map +0 -1
- package/dist-esm/src/eventDataAdapter.js.map +0 -1
- package/dist-esm/src/eventDataBatch.js.map +0 -1
- package/dist-esm/src/eventHubBufferedProducerClient.js.map +0 -1
- package/dist-esm/src/eventHubConsumerClient.js.map +0 -1
- package/dist-esm/src/eventHubConsumerClientModels.js +0 -4
- package/dist-esm/src/eventHubConsumerClientModels.js.map +0 -1
- package/dist-esm/src/eventHubProducerClient.js.map +0 -1
- package/dist-esm/src/eventHubSender.js.map +0 -1
- package/dist-esm/src/eventProcessor.js.map +0 -1
- package/dist-esm/src/eventhubConnectionConfig.js.map +0 -1
- package/dist-esm/src/impl/partitionAssigner.js.map +0 -1
- package/dist-esm/src/inMemoryCheckpointStore.js.map +0 -1
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/loadBalancerStrategies/balancedStrategy.js.map +0 -1
- package/dist-esm/src/loadBalancerStrategies/greedyStrategy.js.map +0 -1
- package/dist-esm/src/loadBalancerStrategies/loadBalancingStrategy.js.map +0 -1
- package/dist-esm/src/loadBalancerStrategies/unbalancedStrategy.js.map +0 -1
- package/dist-esm/src/managementClient.js.map +0 -1
- package/dist-esm/src/models/private.js.map +0 -1
- package/dist-esm/src/models/public.js.map +0 -1
- package/dist-esm/src/partitionProcessor.js.map +0 -1
- package/dist-esm/src/partitionPump.js.map +0 -1
- package/dist-esm/src/partitionReceiver.js.map +0 -1
- package/dist-esm/src/pumpManager.js.map +0 -1
- package/dist-esm/src/util/error.js.map +0 -1
- package/dist-esm/src/util/operationOptions.js +0 -4
- package/dist-esm/src/util/runtimeInfo.browser.js.map +0 -1
- package/dist-esm/src/withAuth.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
3
|
import { isDefined } from "@azure/core-util";
|
|
4
|
-
import { mapPartitionKeyToId } from "./partitionKeyToIdMapper";
|
|
4
|
+
import { mapPartitionKeyToId } from "./partitionKeyToIdMapper.js";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
* Assigns a partition based on the partition ids it knows about and an optional partition id or partition key.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partitionAssigner.js","sourceRoot":"","sources":["../../../src/impl/partitionAssigner.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO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,CAAC;QAE1E,IAAI,CAAC,6BAA6B,GAAG,kBAAkB,CAAC;QACxD,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAC9C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isDefined } from \"@azure/core-util\";\nimport { mapPartitionKeyToId } from \"./partitionKeyToIdMapper.js\";\n\n/**\n * @internal\n * Assigns a partition based on the partition ids it knows about and an optional partition id or partition key.\n */\nexport class PartitionAssigner {\n private _partitions: string[] = [];\n\n private _lastRoundRobinPartitionIndex: number = -1;\n\n /**\n * Set the partition ids that can be used when assigning a partition.\n * @param partitionIds - All valid partition ids.\n */\n public setPartitionIds(partitionIds: string[]): void {\n this._partitions = partitionIds;\n }\n\n /**\n * Returns a partitionId from the list of partition ids set via `setPartitionIds`.\n *\n * If a partitionId is specified, then that will be returned directly.\n * If a partitionKey is specified, then a partitionId will be calculated based on the partitionKey.\n * Specifying both partitionId and partitionKey results in an error.\n *\n * If neither partitionId nor partitionKey are specified, then a partitionId will be selected\n * based on a round-robin approach.\n */\n assignPartition({\n partitionId,\n partitionKey,\n }: {\n partitionId?: string;\n partitionKey?: string;\n }): string {\n if (isDefined(partitionId) && isDefined(partitionKey)) {\n throw new Error(\n `The partitionId (${partitionId}) and partitionKey (${partitionKey}) cannot both be specified.`,\n );\n }\n\n if (!this._partitions.length) {\n throw new Error(`Unable to determine partitionIds, can't assign partitionId.`);\n }\n\n if (isDefined(partitionId) && this._partitions.includes(partitionId)) {\n return partitionId;\n }\n\n if (isDefined(partitionKey)) {\n return mapPartitionKeyToId(partitionKey, this._partitions.length).toString();\n }\n\n return this._assignRoundRobinPartition();\n }\n\n private _assignRoundRobinPartition(): string {\n const maxPartitionIndex = this._partitions.length - 1;\n const proposedPartitionIndex = this._lastRoundRobinPartitionIndex + 1;\n\n const nextPartitionIndex =\n proposedPartitionIndex > maxPartitionIndex ? 0 : proposedPartitionIndex;\n\n this._lastRoundRobinPartitionIndex = nextPartitionIndex;\n return this._partitions[nextPartitionIndex];\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used by EventHubConsumerClient to prevent accidentally spinning up multiple
|
|
3
|
+
* subscriptions against the same set of partitions.
|
|
4
|
+
*
|
|
5
|
+
* This is needed now that EventHubConsumerClient only uses a single CheckpointStore
|
|
6
|
+
* instance - otherwise users will see unpredictable results as their event processor
|
|
7
|
+
* continually steals/overwrites checkpointing and ownership with itself.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class PartitionGate {
|
|
12
|
+
private _partitions;
|
|
13
|
+
/**
|
|
14
|
+
* Adds a partition, throwing an Error if there is a conflict with partitions (including "all")
|
|
15
|
+
* that are already added.
|
|
16
|
+
*
|
|
17
|
+
* @param partitionId - A partition ID or the constant "all"
|
|
18
|
+
*/
|
|
19
|
+
add(partitionId: string | "all"): void;
|
|
20
|
+
/**
|
|
21
|
+
* Removes a partition
|
|
22
|
+
*
|
|
23
|
+
* @param partitionId - A partition ID or the constant "all"
|
|
24
|
+
*/
|
|
25
|
+
remove(partitionId: string | "all"): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=partitionGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partitionGate.d.ts","sourceRoot":"","sources":["../../../src/impl/partitionGate.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,WAAW,CAAqB;IAExC;;;;;OAKG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAYtC;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;CAG1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partitionGate.js","sourceRoot":"","sources":["../../../src/impl/partitionGate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IAA1B;QACU,gBAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IA4B1C,CAAC;IA1BC;;;;;OAKG;IACH,GAAG,CAAC,WAA2B;QAC7B,IACE,CAAC,WAAW,KAAK,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC;YACpD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAC3B,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAA2B;QAChC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"partitionGate.js","sourceRoot":"","sources":["../../../src/impl/partitionGate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IAA1B;QACU,gBAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IA4B1C,CAAC;IA1BC;;;;;OAKG;IACH,GAAG,CAAC,WAA2B;QAC7B,IACE,CAAC,WAAW,KAAK,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC;YACpD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAC3B,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAA2B;QAChC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Used by EventHubConsumerClient to prevent accidentally spinning up multiple\n * subscriptions against the same set of partitions.\n *\n * This is needed now that EventHubConsumerClient only uses a single CheckpointStore\n * instance - otherwise users will see unpredictable results as their event processor\n * continually steals/overwrites checkpointing and ownership with itself.\n *\n * @internal\n */\nexport class PartitionGate {\n private _partitions = new Set<string>();\n\n /**\n * Adds a partition, throwing an Error if there is a conflict with partitions (including \"all\")\n * that are already added.\n *\n * @param partitionId - A partition ID or the constant \"all\"\n */\n add(partitionId: string | \"all\"): void {\n if (\n (partitionId === \"all\" && this._partitions.size > 0) ||\n this._partitions.has(partitionId) ||\n this._partitions.has(\"all\")\n ) {\n throw new Error(`Partition already has a subscriber.`);\n }\n\n this._partitions.add(partitionId);\n }\n\n /**\n * Removes a partition\n *\n * @param partitionId - A partition ID or the constant \"all\"\n */\n remove(partitionId: string | \"all\"): void {\n this._partitions.delete(partitionId);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partitionKeyToIdMapper.d.ts","sourceRoot":"","sources":["../../../src/impl/partitionKeyToIdMapper.ts"],"names":[],"mappings":"AAKA,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGxF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAG7D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
3
|
/* eslint-disable no-fallthrough */
|
|
4
4
|
export function mapPartitionKeyToId(partitionKey, partitionCount) {
|
|
5
5
|
const hashedParitionKey = hashPartitionKey(partitionKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partitionKeyToIdMapper.js","sourceRoot":"","sources":["../../../src/impl/partitionKeyToIdMapper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,mCAAmC;AAEnC,MAAM,UAAU,mBAAmB,CAAC,YAAoB,EAAE,cAAsB;IAC9E,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,GAAG,cAAc,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAoB;IACnD,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,MAAc;IAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,WAAW,CAClB,IAAY,EACZ,QAAgB,CAAC,EACjB,QAAgB,CAAC;IAKjB,IAAI,CAAS,EAAE,CAAS,EAAE,CAAS,CAAC;IAEpC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IAC7C,CAAC,IAAI,KAAK,CAAC;IAEX,IAAI,KAAK,GAAG,CAAC,EACX,IAAI,GAAG,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,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3B,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"partitionKeyToIdMapper.js","sourceRoot":"","sources":["../../../src/impl/partitionKeyToIdMapper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,mCAAmC;AAEnC,MAAM,UAAU,mBAAmB,CAAC,YAAoB,EAAE,cAAsB;IAC9E,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,GAAG,cAAc,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAoB;IACnD,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,MAAc;IAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,WAAW,CAClB,IAAY,EACZ,QAAgB,CAAC,EACjB,QAAgB,CAAC;IAKjB,IAAI,CAAS,EAAE,CAAS,EAAE,CAAS,CAAC;IAEpC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,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,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAE5B,CAAC,IAAI,CAAC,CAAC;IACP,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3B,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable no-fallthrough */\n\nexport function mapPartitionKeyToId(partitionKey: string, partitionCount: number): number {\n const hashedParitionKey = hashPartitionKey(partitionKey);\n return Math.abs(hashedParitionKey % partitionCount);\n}\n\n/**\n * @internal\n */\nexport function hashPartitionKey(partitionKey: string): number {\n const hash = computeHash(Buffer.from(partitionKey, \"utf8\"));\n return castToInt16(hash.c ^ hash.b);\n}\n\nfunction readUInt32(data: Buffer, offset: number): number {\n return data.readUInt32LE(offset);\n}\n\nfunction castToInt16(n: number): number {\n return new Int16Array([n])[0];\n}\n\nfunction computeHash(\n data: Buffer,\n seed1: number = 0,\n seed2: number = 0,\n): {\n b: number;\n c: number;\n} {\n let a: number, b: number, c: number;\n\n a = b = c = 0xdeadbeef + data.length + seed1;\n c += seed2;\n\n let index = 0,\n size = data.length;\n while (size > 12) {\n a += readUInt32(data, index);\n b += readUInt32(data, index + 4);\n c += readUInt32(data, index + 8);\n\n a -= c;\n a ^= (c << 4) | (c >>> 28);\n c += b;\n\n b -= a;\n b ^= (a << 6) | (a >>> 26);\n a += c;\n\n c -= b;\n c ^= (b << 8) | (b >>> 24);\n b += a;\n\n a -= c;\n a ^= (c << 16) | (c >>> 16);\n c += b;\n\n b -= a;\n b ^= (a << 19) | (a >>> 13);\n a += c;\n\n c -= b;\n c ^= (b << 4) | (b >>> 28);\n b += a;\n\n index += 12;\n size -= 12;\n }\n\n let curr = size;\n switch (curr) {\n case 12:\n a += readUInt32(data, index);\n b += readUInt32(data, index + 4);\n c += readUInt32(data, index + 8);\n break;\n case 11:\n c += data[index + 10] << 16;\n curr = 10;\n case 10:\n c += data[index + 9] << 8;\n curr = 9;\n case 9:\n c += data[index + 8];\n curr = 8;\n case 8:\n b += readUInt32(data, index + 4);\n a += readUInt32(data, index);\n break;\n case 7:\n b += data[index + 6] << 16;\n curr = 6;\n case 6:\n b += data[index + 5] << 8;\n curr = 5;\n case 5:\n b += data[index + 4];\n curr = 4;\n case 4:\n a += readUInt32(data, index);\n break;\n case 3:\n a += data[index + 2] << 16;\n curr = 2;\n case 2:\n a += data[index + 1] << 8;\n curr = 1;\n case 1:\n a += data[index];\n break;\n case 0:\n return { b: b >>> 0, c: c >>> 0 };\n }\n\n c ^= b;\n c -= (b << 14) | (b >>> 18);\n\n a ^= c;\n a -= (c << 11) | (c >>> 21);\n\n b ^= a;\n b -= (a << 25) | (a >>> 7);\n\n c ^= b;\n c -= (b << 16) | (b >>> 16);\n\n a ^= c;\n a -= (c << 4) | (c >>> 28);\n\n b ^= a;\n b -= (a << 14) | (a >>> 18);\n\n c ^= b;\n c -= (b << 24) | (b >>> 8);\n\n return { b: b >>> 0, c: c >>> 0 };\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CheckpointStore, PartitionOwnership } from "./eventProcessor.js";
|
|
2
|
+
import { Checkpoint } from "./partitionProcessor.js";
|
|
3
|
+
/**
|
|
4
|
+
* The `EventProcessor` relies on a `CheckpointStore` to store checkpoints and handle partition
|
|
5
|
+
* ownerships. `InMemoryCheckpointStore` is simple partition manager that stores checkpoints and
|
|
6
|
+
* partition ownerships in memory of your program.
|
|
7
|
+
*
|
|
8
|
+
* You can use the `InMemoryCheckpointStore` to get started with using the `EventProcessor`.
|
|
9
|
+
* But in production, you should choose an implementation of the `CheckpointStore` interface that will
|
|
10
|
+
* store the checkpoints and partition ownerships to a durable store instead.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare class InMemoryCheckpointStore implements CheckpointStore {
|
|
15
|
+
private _partitionOwnershipMap;
|
|
16
|
+
private _committedCheckpoints;
|
|
17
|
+
/**
|
|
18
|
+
* Get the list of all existing partition ownership from the underlying data store. Could return empty
|
|
19
|
+
* results if there are is no existing ownership information.
|
|
20
|
+
*
|
|
21
|
+
* @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to
|
|
22
|
+
* <yournamespace>.servicebus.windows.net.
|
|
23
|
+
* @param eventHubName - The event hub name.
|
|
24
|
+
* @param consumerGroup - The consumer group name.
|
|
25
|
+
* @returns Partition ownership details of all the partitions that have/had an owner..
|
|
26
|
+
*/
|
|
27
|
+
listOwnership(_fullyQualifiedNamespace: string, _eventHubName: string, _consumerGroup: string): Promise<PartitionOwnership[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Claim ownership of a list of partitions. This will return the list of partitions that were owned
|
|
30
|
+
* successfully.
|
|
31
|
+
*
|
|
32
|
+
* @param partitionOwnership - The list of partition ownership this instance is claiming to own.
|
|
33
|
+
* @returns A list partitions this instance successfully claimed ownership.
|
|
34
|
+
*/
|
|
35
|
+
claimOwnership(partitionOwnership: PartitionOwnership[]): Promise<PartitionOwnership[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Updates the checkpoint in the data store for a partition.
|
|
38
|
+
*
|
|
39
|
+
* @param checkpoint - The checkpoint.
|
|
40
|
+
*/
|
|
41
|
+
updateCheckpoint(checkpoint: Checkpoint): Promise<void>;
|
|
42
|
+
listCheckpoints(fullyQualifiedNamespace: string, eventHubName: string, consumerGroup: string): Promise<Checkpoint[]>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=inMemoryCheckpointStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inMemoryCheckpointStore.d.ts","sourceRoot":"","sources":["../../src/inMemoryCheckpointStore.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD;;;;;;;;;;GAUG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,qBAAqB,CAAmD;IAEhF;;;;;;;;;OASG;IACG,aAAa,CACjB,wBAAwB,EAAE,MAAM,EAChC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAUhC;;;;;;OAMG;IACG,cAAc,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAuB7F;;;;OAIG;IACG,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BvD,eAAe,CACnB,uBAAuB,EAAE,MAAM,EAC/B,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,UAAU,EAAE,CAAC;CAiBzB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
import { throwTypeErrorIfParameterMissing } from "./util/error";
|
|
4
|
-
import { getRandomName } from "./util/utils";
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { throwTypeErrorIfParameterMissing } from "./util/error.js";
|
|
4
|
+
import { getRandomName } from "./util/utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* The `EventProcessor` relies on a `CheckpointStore` to store checkpoints and handle partition
|
|
7
7
|
* ownerships. `InMemoryCheckpointStore` is simple partition manager that stores checkpoints and
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inMemoryCheckpointStore.js","sourceRoot":"","sources":["../../src/inMemoryCheckpointStore.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCA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YACzB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1C,WAAW,CAAC,IAAI,mBAAM,KAAK,EAAG,CAAC;QACjC,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CheckpointStore, PartitionOwnership } from \"./eventProcessor.js\";\nimport { Checkpoint } from \"./partitionProcessor.js\";\nimport { throwTypeErrorIfParameterMissing } from \"./util/error.js\";\nimport { getRandomName } from \"./util/utils.js\";\n\n/**\n * The `EventProcessor` relies on a `CheckpointStore` to store checkpoints and handle partition\n * ownerships. `InMemoryCheckpointStore` is simple partition manager that stores checkpoints and\n * partition ownerships in memory of your program.\n *\n * You can use the `InMemoryCheckpointStore` to get started with using the `EventProcessor`.\n * But in production, you should choose an implementation of the `CheckpointStore` interface that will\n * store the checkpoints and partition ownerships to a durable store instead.\n *\n * @internal\n */\nexport class InMemoryCheckpointStore implements CheckpointStore {\n private _partitionOwnershipMap: Map<string, PartitionOwnership> = new Map();\n private _committedCheckpoints: Map<string, Map<string, Checkpoint>> = new Map();\n\n /**\n * Get the list of all existing partition ownership from the underlying data store. Could return empty\n * results if there are is no existing ownership information.\n *\n * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net.\n * @param eventHubName - The event hub name.\n * @param consumerGroup - The consumer group name.\n * @returns Partition ownership details of all the partitions that have/had an owner..\n */\n async listOwnership(\n _fullyQualifiedNamespace: string,\n _eventHubName: string,\n _consumerGroup: string,\n ): Promise<PartitionOwnership[]> {\n const ownerships = [];\n\n for (const value of this._partitionOwnershipMap.values()) {\n ownerships.push({ ...value });\n }\n\n return ownerships;\n }\n\n /**\n * Claim ownership of a list of partitions. This will return the list of partitions that were owned\n * successfully.\n *\n * @param partitionOwnership - The list of partition ownership this instance is claiming to own.\n * @returns A list partitions this instance successfully claimed ownership.\n */\n async claimOwnership(partitionOwnership: PartitionOwnership[]): Promise<PartitionOwnership[]> {\n const claimedOwnerships = [];\n\n for (const ownership of partitionOwnership) {\n if (\n !this._partitionOwnershipMap.has(ownership.partitionId) ||\n this._partitionOwnershipMap.get(ownership.partitionId)!.etag === ownership.etag\n ) {\n const date = new Date();\n\n const newOwnership = {\n ...ownership,\n etag: getRandomName(),\n lastModifiedTimeInMs: date.getTime(),\n };\n\n this._partitionOwnershipMap.set(newOwnership.partitionId, newOwnership);\n claimedOwnerships.push(newOwnership);\n }\n }\n return claimedOwnerships;\n }\n\n /**\n * Updates the checkpoint in the data store for a partition.\n *\n * @param checkpoint - The checkpoint.\n */\n async updateCheckpoint(checkpoint: Checkpoint): Promise<void> {\n throwTypeErrorIfParameterMissing(\n \"\",\n \"updateCheckpoint\",\n \"sequenceNumber\",\n checkpoint.sequenceNumber,\n );\n throwTypeErrorIfParameterMissing(\"\", \"updateCheckpoint\", \"offset\", checkpoint.offset);\n\n checkpoint = { ...checkpoint };\n\n const partitionOwnership = this._partitionOwnershipMap.get(checkpoint.partitionId);\n if (partitionOwnership) {\n partitionOwnership.etag = getRandomName();\n\n const key = `${checkpoint.fullyQualifiedNamespace}:${checkpoint.eventHubName}:${checkpoint.consumerGroup}`;\n let partitionMap = this._committedCheckpoints.get(key);\n\n if (partitionMap == null) {\n partitionMap = new Map();\n this._committedCheckpoints.set(key, partitionMap);\n }\n\n partitionMap.set(checkpoint.partitionId, checkpoint);\n }\n }\n\n async listCheckpoints(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n consumerGroup: string,\n ): Promise<Checkpoint[]> {\n const key = `${fullyQualifiedNamespace}:${eventHubName}:${consumerGroup}`;\n\n const partitionMap = this._committedCheckpoints.get(key);\n\n if (partitionMap == null) {\n return [];\n }\n\n const checkpoints = [];\n\n for (const value of partitionMap.values()) {\n checkpoints.push({ ...value });\n }\n\n return checkpoints;\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { EventData, ReceivedEventData } from "./eventData.js";
|
|
2
|
+
export { WebSocketImpl } from "rhea-promise";
|
|
3
|
+
export { LastEnqueuedEventProperties } from "./partitionReceiver.js";
|
|
4
|
+
export { OperationOptions } from "./util/operationOptions.js";
|
|
5
|
+
export { EventHubClientOptions, EventHubConsumerClientOptions, LoadBalancingOptions, SendBatchOptions, CreateBatchOptions, GetPartitionIdsOptions, GetPartitionPropertiesOptions, GetEventHubPropertiesOptions, } from "./models/public.js";
|
|
6
|
+
export { EventHubConsumerClient } from "./eventHubConsumerClient.js";
|
|
7
|
+
export { EventHubProducerClient } from "./eventHubProducerClient.js";
|
|
8
|
+
export { BufferedCloseOptions, EventHubBufferedProducerClient, EventHubBufferedProducerClientOptions, EnqueueEventOptions, BufferedFlushOptions, OnSendEventsErrorContext, OnSendEventsSuccessContext, } from "./eventHubBufferedProducerClient.js";
|
|
9
|
+
export { SubscribeOptions, Subscription, SubscriptionEventHandlers, PartitionContext, ProcessErrorHandler, ProcessInitializeHandler, ProcessCloseHandler, ProcessEventsHandler, } from "./eventHubConsumerClientModels.js";
|
|
10
|
+
export { EventPosition, latestEventPosition, earliestEventPosition } from "./eventPosition.js";
|
|
11
|
+
export { PartitionProperties, EventHubProperties } from "./managementClient.js";
|
|
12
|
+
export { EventDataBatch, TryAddOptions } from "./eventDataBatch.js";
|
|
13
|
+
export { Checkpoint } from "./partitionProcessor.js";
|
|
14
|
+
export { CheckpointStore, PartitionOwnership } from "./eventProcessor.js";
|
|
15
|
+
export { CloseReason } from "./models/public.js";
|
|
16
|
+
export { MessagingError, RetryOptions, RetryMode, WebSocketOptions } from "@azure/core-amqp";
|
|
17
|
+
export { TokenCredential } from "@azure/core-auth";
|
|
18
|
+
export { logger } from "./logger.js";
|
|
19
|
+
export { parseEventHubConnectionString, EventHubConnectionStringProperties, } from "./util/connectionStringUtils.js";
|
|
20
|
+
export * from "./eventDataAdapter.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,qCAAqC,EACrC,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,iCAAiC,CAAC;AAEzC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
export { EventHubConsumerClient } from "./eventHubConsumerClient";
|
|
4
|
-
export { EventHubProducerClient } from "./eventHubProducerClient";
|
|
5
|
-
export { EventHubBufferedProducerClient, } from "./eventHubBufferedProducerClient";
|
|
6
|
-
export { latestEventPosition, earliestEventPosition } from "./eventPosition";
|
|
7
|
-
export { CloseReason } from "./models/public";
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export { EventHubConsumerClient } from "./eventHubConsumerClient.js";
|
|
4
|
+
export { EventHubProducerClient } from "./eventHubProducerClient.js";
|
|
5
|
+
export { EventHubBufferedProducerClient, } from "./eventHubBufferedProducerClient.js";
|
|
6
|
+
export { latestEventPosition, earliestEventPosition } from "./eventPosition.js";
|
|
7
|
+
export { CloseReason } from "./models/public.js";
|
|
8
8
|
export { MessagingError, RetryMode } from "@azure/core-amqp";
|
|
9
|
-
export { logger } from "./logger";
|
|
10
|
-
export { parseEventHubConnectionString, } from "./util/connectionStringUtils";
|
|
11
|
-
export * from "./eventDataAdapter";
|
|
9
|
+
export { logger } from "./logger.js";
|
|
10
|
+
export { parseEventHubConnectionString, } from "./util/connectionStringUtils.js";
|
|
11
|
+
export * from "./eventDataAdapter.js";
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAEL,8BAA8B,GAM/B,MAAM,qCAAqC,CAAC;AAW7C,OAAO,EAAiB,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAK/F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAgB,SAAS,EAAoB,MAAM,kBAAkB,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,6BAA6B,GAE9B,MAAM,iCAAiC,CAAC;AAEzC,cAAc,uBAAuB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { EventData, ReceivedEventData } from \"./eventData.js\";\nexport { WebSocketImpl } from \"rhea-promise\";\nexport { LastEnqueuedEventProperties } from \"./partitionReceiver.js\";\nexport { OperationOptions } from \"./util/operationOptions.js\";\nexport {\n EventHubClientOptions,\n EventHubConsumerClientOptions,\n LoadBalancingOptions,\n SendBatchOptions,\n CreateBatchOptions,\n GetPartitionIdsOptions,\n GetPartitionPropertiesOptions,\n GetEventHubPropertiesOptions,\n} from \"./models/public.js\";\nexport { EventHubConsumerClient } from \"./eventHubConsumerClient.js\";\nexport { EventHubProducerClient } from \"./eventHubProducerClient.js\";\nexport {\n BufferedCloseOptions,\n EventHubBufferedProducerClient,\n EventHubBufferedProducerClientOptions,\n EnqueueEventOptions,\n BufferedFlushOptions,\n OnSendEventsErrorContext,\n OnSendEventsSuccessContext,\n} from \"./eventHubBufferedProducerClient.js\";\nexport {\n SubscribeOptions,\n Subscription,\n SubscriptionEventHandlers,\n PartitionContext,\n ProcessErrorHandler,\n ProcessInitializeHandler,\n ProcessCloseHandler,\n ProcessEventsHandler,\n} from \"./eventHubConsumerClientModels.js\";\nexport { EventPosition, latestEventPosition, earliestEventPosition } from \"./eventPosition.js\";\nexport { PartitionProperties, EventHubProperties } from \"./managementClient.js\";\nexport { EventDataBatch, TryAddOptions } from \"./eventDataBatch.js\";\nexport { Checkpoint } from \"./partitionProcessor.js\";\nexport { CheckpointStore, PartitionOwnership } from \"./eventProcessor.js\";\nexport { CloseReason } from \"./models/public.js\";\nexport { MessagingError, RetryOptions, RetryMode, WebSocketOptions } from \"@azure/core-amqp\";\nexport { TokenCredential } from \"@azure/core-auth\";\nexport { logger } from \"./logger.js\";\nexport {\n parseEventHubConnectionString,\n EventHubConnectionStringProperties,\n} from \"./util/connectionStringUtils.js\";\n\nexport * from \"./eventDataAdapter.js\";\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LoadBalancingStrategy } from "./loadBalancingStrategy.js";
|
|
2
|
+
import { PartitionOwnership } from "../eventProcessor.js";
|
|
3
|
+
/**
|
|
4
|
+
* The BalancedLoadBalancerStrategy is meant to be used when the user
|
|
5
|
+
* wants to reach a load balanced state with less partition 'thrashing'.
|
|
6
|
+
*
|
|
7
|
+
* Partition thrashing - where a partition changes owners - is minimized
|
|
8
|
+
* by only returning a single partition to claim at a time.
|
|
9
|
+
* This minimizes the number of times a partition should need to be stolen.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class BalancedLoadBalancingStrategy implements LoadBalancingStrategy {
|
|
13
|
+
private readonly _partitionOwnershipExpirationIntervalInMs;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of BalancedLoadBalancingStrategy.
|
|
16
|
+
*
|
|
17
|
+
* @param _partitionOwnershipExpirationIntervalInMs - The length of time a partition claim is valid.
|
|
18
|
+
*/
|
|
19
|
+
constructor(_partitionOwnershipExpirationIntervalInMs: number);
|
|
20
|
+
/**
|
|
21
|
+
* Implements load balancing by taking into account current ownership and
|
|
22
|
+
* the full set of partitions in the Event Hub.
|
|
23
|
+
* @param ourOwnerId - The id we should assume is _our_ id when checking for ownership.
|
|
24
|
+
* @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.
|
|
25
|
+
* @param partitionIds - Partitions to assign owners to.
|
|
26
|
+
* @returns Partition ids to claim.
|
|
27
|
+
*/
|
|
28
|
+
getPartitionsToClaim(ourOwnerId: string, claimedPartitionOwnershipMap: Map<string, PartitionOwnership>, partitionIds: string[]): string[];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=balancedStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balancedStrategy.d.ts","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/balancedStrategy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAA2B,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;GAQG;AACH,qBAAa,6BAA8B,YAAW,qBAAqB;IAM7D,OAAO,CAAC,QAAQ,CAAC,yCAAyC;IALtE;;;;OAIG;gBAC0B,yCAAyC,EAAE,MAAM;IAE9E;;;;;;;OAOG;IACI,oBAAoB,CACzB,UAAU,EAAE,MAAM,EAClB,4BAA4B,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7D,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE;CAeZ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
import { listAvailablePartitions } from "./loadBalancingStrategy";
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { listAvailablePartitions } from "./loadBalancingStrategy.js";
|
|
4
4
|
/**
|
|
5
5
|
* The BalancedLoadBalancerStrategy is meant to be used when the user
|
|
6
6
|
* wants to reach a load balanced state with less partition 'thrashing'.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balancedStrategy.js","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/balancedStrategy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG5F;;;;;;;;GAQG;AACH,MAAM,OAAO,6BAA6B;IACxC;;;;OAIG;IACH,YAA6B,yCAAiD;QAAjD,8CAAyC,GAAzC,yCAAyC,CAAQ;IAAG,CAAC;IAElF;;;;;;;OAOG;IACI,oBAAoB,CACzB,UAAkB,EAClB,4BAA6D,EAC7D,YAAsB;QAEtB,MAAM,mBAAmB,GAAG,uBAAuB,CACjD,UAAU,EACV,4BAA4B,EAC5B,YAAY,EACZ,IAAI,CAAC,yCAAyC,CAC/C,CAAC;QAEF,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;YAChC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC3E,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LoadBalancingStrategy, listAvailablePartitions } from \"./loadBalancingStrategy.js\";\nimport { PartitionOwnership } from \"../eventProcessor.js\";\n\n/**\n * The BalancedLoadBalancerStrategy is meant to be used when the user\n * wants to reach a load balanced state with less partition 'thrashing'.\n *\n * Partition thrashing - where a partition changes owners - is minimized\n * by only returning a single partition to claim at a time.\n * This minimizes the number of times a partition should need to be stolen.\n * @internal\n */\nexport class BalancedLoadBalancingStrategy implements LoadBalancingStrategy {\n /**\n * Creates an instance of BalancedLoadBalancingStrategy.\n *\n * @param _partitionOwnershipExpirationIntervalInMs - The length of time a partition claim is valid.\n */\n constructor(private readonly _partitionOwnershipExpirationIntervalInMs: number) {}\n\n /**\n * Implements load balancing by taking into account current ownership and\n * the full set of partitions in the Event Hub.\n * @param ourOwnerId - The id we should assume is _our_ id when checking for ownership.\n * @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.\n * @param partitionIds - Partitions to assign owners to.\n * @returns Partition ids to claim.\n */\n public getPartitionsToClaim(\n ourOwnerId: string,\n claimedPartitionOwnershipMap: Map<string, PartitionOwnership>,\n partitionIds: string[],\n ): string[] {\n const claimablePartitions = listAvailablePartitions(\n ourOwnerId,\n claimedPartitionOwnershipMap,\n partitionIds,\n this._partitionOwnershipExpirationIntervalInMs,\n );\n\n if (!claimablePartitions.length) {\n return [];\n }\n\n const randomIndex = Math.floor(Math.random() * claimablePartitions.length);\n return [claimablePartitions[randomIndex]];\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LoadBalancingStrategy } from "./loadBalancingStrategy.js";
|
|
2
|
+
import { PartitionOwnership } from "../eventProcessor.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class GreedyLoadBalancingStrategy implements LoadBalancingStrategy {
|
|
7
|
+
private readonly _partitionOwnershipExpirationIntervalInMs;
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of GreedyLoadBalancingStrategy.
|
|
10
|
+
*
|
|
11
|
+
* @param _partitionOwnershipExpirationIntervalInMs - The length of time a partition claim is valid.
|
|
12
|
+
*/
|
|
13
|
+
constructor(_partitionOwnershipExpirationIntervalInMs: number);
|
|
14
|
+
/**
|
|
15
|
+
* Implements load balancing by taking into account current ownership and
|
|
16
|
+
* the new set of partitions to add.
|
|
17
|
+
* @param ourOwnerId - The id we should assume is _our_ id when checking for ownership.
|
|
18
|
+
* @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.
|
|
19
|
+
* @param partitionIds - Partitions to assign owners to.
|
|
20
|
+
* @returns Partition ids to claim.
|
|
21
|
+
*/
|
|
22
|
+
getPartitionsToClaim(ourOwnerId: string, claimedPartitionOwnershipMap: Map<string, PartitionOwnership>, partitionIds: string[]): string[];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=greedyStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greedyStrategy.d.ts","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/greedyStrategy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAA2B,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,2BAA4B,YAAW,qBAAqB;IAM3D,OAAO,CAAC,QAAQ,CAAC,yCAAyC;IALtE;;;;OAIG;gBAC0B,yCAAyC,EAAE,MAAM;IAE9E;;;;;;;OAOG;IACI,oBAAoB,CACzB,UAAU,EAAE,MAAM,EAClB,4BAA4B,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7D,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE;CAQZ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
import { listAvailablePartitions } from "./loadBalancingStrategy";
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { listAvailablePartitions } from "./loadBalancingStrategy.js";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greedyStrategy.js","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/greedyStrategy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG5F;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACtC;;;;OAIG;IACH,YAA6B,yCAAiD;QAAjD,8CAAyC,GAAzC,yCAAyC,CAAQ;IAAG,CAAC;IAElF;;;;;;;OAOG;IACI,oBAAoB,CACzB,UAAkB,EAClB,4BAA6D,EAC7D,YAAsB;QAEtB,OAAO,uBAAuB,CAC5B,UAAU,EACV,4BAA4B,EAC5B,YAAY,EACZ,IAAI,CAAC,yCAAyC,CAC/C,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LoadBalancingStrategy, listAvailablePartitions } from \"./loadBalancingStrategy.js\";\nimport { PartitionOwnership } from \"../eventProcessor.js\";\n\n/**\n * @internal\n */\nexport class GreedyLoadBalancingStrategy implements LoadBalancingStrategy {\n /**\n * Creates an instance of GreedyLoadBalancingStrategy.\n *\n * @param _partitionOwnershipExpirationIntervalInMs - The length of time a partition claim is valid.\n */\n constructor(private readonly _partitionOwnershipExpirationIntervalInMs: number) {}\n\n /**\n * Implements load balancing by taking into account current ownership and\n * the new set of partitions to add.\n * @param ourOwnerId - The id we should assume is _our_ id when checking for ownership.\n * @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.\n * @param partitionIds - Partitions to assign owners to.\n * @returns Partition ids to claim.\n */\n public getPartitionsToClaim(\n ourOwnerId: string,\n claimedPartitionOwnershipMap: Map<string, PartitionOwnership>,\n partitionIds: string[],\n ): string[] {\n return listAvailablePartitions(\n ourOwnerId,\n claimedPartitionOwnershipMap,\n partitionIds,\n this._partitionOwnershipExpirationIntervalInMs,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PartitionOwnership } from "../eventProcessor.js";
|
|
2
|
+
/**
|
|
3
|
+
* Determines which partitions to claim as part of load balancing.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface LoadBalancingStrategy {
|
|
7
|
+
/**
|
|
8
|
+
* Implements load balancing by taking into account current ownership and
|
|
9
|
+
* the full set of partitions in the Event Hub.
|
|
10
|
+
* @param ourOwnerId - The id we should assume is _our_ id when checking for ownership.
|
|
11
|
+
* @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.
|
|
12
|
+
* @param partitionIds - Partitions to assign owners to.
|
|
13
|
+
* @returns Partition ids to claim.
|
|
14
|
+
*/
|
|
15
|
+
getPartitionsToClaim(ownerId: string, claimedPartitionOwnershipMap: Map<string, PartitionOwnership>, partitionIds: string[]): string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Identifies all of the partitions that can be claimed by the specified owner for
|
|
19
|
+
* that owner to reach a balanced state.
|
|
20
|
+
* @param OwnerId - The id we should assume is _our_ id when checking for ownership.
|
|
21
|
+
* @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.
|
|
22
|
+
* @param partitionIds - Partitions to assign owners to.
|
|
23
|
+
* @param expirationIntervalInMs - The length of time a partition claim is valid.
|
|
24
|
+
* @returns Partition ids that may be claimed.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function listAvailablePartitions(ownerId: string, claimedPartitionOwnershipMap: Map<string, PartitionOwnership>, partitionIds: string[], expirationIntervalInMs: number): string[];
|
|
28
|
+
//# sourceMappingURL=loadBalancingStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadBalancingStrategy.d.ts","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/loadBalancingStrategy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,oBAAoB,CAClB,OAAO,EAAE,MAAM,EACf,4BAA4B,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7D,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE,CAAC;CACb;AA2PD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,4BAA4B,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7D,YAAY,EAAE,MAAM,EAAE,EACtB,sBAAsB,EAAE,MAAM,GAC7B,MAAM,EAAE,CA8FV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
import { logger } from "../logger";
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
4
|
/**
|
|
5
5
|
* This method will create a new map of partition id and PartitionOwnership containing only those partitions
|
|
6
6
|
* that are actively owned.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadBalancingStrategy.js","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/loadBalancingStrategy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA+CtC;;;;;;;;;GASG;AACH,SAAS,4BAA4B,CACnC,qBAAsD,EACtD,sBAA8B;IAE9B,MAAM,2BAA2B,GAAoC,IAAI,GAAG,EAAE,CAAC;IAC/E,qBAAqB,CAAC,OAAO,CAAC,CAAC,kBAAsC,EAAE,WAAmB,EAAE,EAAE;QAC5F,6DAA6D;QAC7D,IACE,OAAO,kBAAkB,CAAC,oBAAoB,KAAK,WAAW;YAC9D,kBAAkB,CAAC,oBAAoB,KAAK,IAAI,EAChD,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,yBAAyB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC,oBAAoB,CAAC;QACvF,IAAI,yBAAyB,GAAG,sBAAsB,IAAI,kBAAkB,CAAC,OAAO,EAAE,CAAC;YACrF,2BAA2B,CAAC,GAAG,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAC,CAAC;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AAC;AACrD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PartitionOwnership } from \"../eventProcessor.js\";\nimport { logger } from \"../logger.js\";\n\n/**\n * Determines which partitions to claim as part of load balancing.\n * @internal\n */\nexport interface LoadBalancingStrategy {\n /**\n * Implements load balancing by taking into account current ownership and\n * the full set of partitions in the Event Hub.\n * @param ourOwnerId - The id we should assume is _our_ id when checking for ownership.\n * @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.\n * @param partitionIds - Partitions to assign owners to.\n * @returns Partition ids to claim.\n */\n getPartitionsToClaim(\n ownerId: string,\n claimedPartitionOwnershipMap: Map<string, PartitionOwnership>,\n partitionIds: string[],\n ): string[];\n}\n\n/**\n * Counts of the EventProcessors that currently own partitions.\n * @internal\n */\ninterface EventProcessorCounts {\n /**\n * The # of EventProcessors that only own the required # of\n * partitions.\n */\n haveRequiredPartitions: number;\n /**\n * The # of EventProcessors that currently own the required #\n * of partitions + 1 additional (ie, handling the case where\n * the number of partitions is not evenly divisible by the # of\n * EventProcessors).\n */\n haveAdditionalPartition: number;\n /**\n * EventProcessors which have more than the required or even required + 1\n * number of partitions. These will eventually be downsized by other\n * EventProcessors as they acquire their required number of partitions.\n */\n haveTooManyPartitions: number;\n}\n\n/**\n * This method will create a new map of partition id and PartitionOwnership containing only those partitions\n * that are actively owned.\n * All entries in the original map that haven't been modified for a duration of time greater than the allowed\n * inactivity time limit are assumed to be owned by dead event processors.\n * These will not be included in the map returned by this method.\n *\n * @param partitionOwnershipMap - The existing PartitionOwnerships mapped by partition.\n * @param expirationIntervalInMs - The length of time a PartitionOwnership claim is valid.\n */\nfunction getActivePartitionOwnerships(\n partitionOwnershipMap: Map<string, PartitionOwnership>,\n expirationIntervalInMs: number,\n): Map<string, PartitionOwnership> {\n const activePartitionOwnershipMap: Map<string, PartitionOwnership> = new Map();\n partitionOwnershipMap.forEach((partitionOwnership: PartitionOwnership, partitionId: string) => {\n // If lastModifiedtimeInMs is missing, assume it is inactive.\n if (\n typeof partitionOwnership.lastModifiedTimeInMs === \"undefined\" ||\n partitionOwnership.lastModifiedTimeInMs === null\n ) {\n return;\n }\n\n const timeSincePartitionClaimed = Date.now() - partitionOwnership.lastModifiedTimeInMs;\n if (timeSincePartitionClaimed < expirationIntervalInMs && partitionOwnership.ownerId) {\n activePartitionOwnershipMap.set(partitionId, partitionOwnership);\n }\n });\n\n return activePartitionOwnershipMap;\n}\n\n/**\n * Calculates the minimum number of partitions each EventProcessor should own,\n * and the number of EventProcessors that should have an extra partition assigned.\n * @param ownerToOwnershipMap - The current ownerships for partitions.\n * @param partitionIds - The full list of the Event Hub's partition ids.\n * @internal\n */\nfunction calculateBalancedLoadCounts(\n ownerToOwnershipMap: Map<string, PartitionOwnership[]>,\n partitionIds: string[],\n): { minPartitionsPerOwner: number; requiredNumberOfOwnersWithExtraPartition: number } {\n // Calculate the minimum number of partitions every EventProcessor should own when the load\n // is evenly distributed.\n const minPartitionsPerOwner = Math.floor(partitionIds.length / ownerToOwnershipMap.size);\n\n // If the number of partitions in the Event Hub is not evenly divisible by the number of active\n // EventProcesrrors, some EventProcessors may own 1 partition in addition to the minimum when the\n // load is balanced.\n // Calculate the number of EventProcessors that can own an additional partition.\n const requiredNumberOfOwnersWithExtraPartition = partitionIds.length % ownerToOwnershipMap.size;\n\n return {\n minPartitionsPerOwner,\n requiredNumberOfOwnersWithExtraPartition,\n };\n}\n\n/**\n * Counts the EventProcessors and tallies them by type.\n *\n * To be in balance we need to make sure that each EventProcessor is only consuming\n * their fair share.\n *\n * When the partitions are divvied up we will sometimes end up with some EventProcessors\n * that will have 1 more partition than others.\n * This can happen if the number of partitions is not evenly divisible by the number of EventProcessors.\n *\n * So this function largely exists to support isLoadBalanced() and\n * shouldOwnMorePartitions(), both of which depend on knowing if our current list\n * of EventProcessors is actually in the proper state.\n *\n * @param minPartitionsPerOwner - The number of required partitions per EventProcessor.\n * @param ownerToOwnershipMap - The current ownerships for partitions.\n * @internal\n */\nfunction getEventProcessorCounts(\n minPartitionsPerOwner: number,\n ownerToOwnershipMap: Map<string, PartitionOwnership[]>,\n): EventProcessorCounts {\n const counts: EventProcessorCounts = {\n haveRequiredPartitions: 0,\n haveAdditionalPartition: 0,\n haveTooManyPartitions: 0,\n };\n\n for (const ownershipList of ownerToOwnershipMap.values()) {\n const numberOfPartitions = ownershipList.length;\n\n // there are basically three kinds of partition counts\n // for a processor:\n\n if (numberOfPartitions === minPartitionsPerOwner) {\n // 1. Has _exactly_ the required number of partitions\n counts.haveRequiredPartitions++;\n } else if (numberOfPartitions === minPartitionsPerOwner + 1) {\n // 2. Has the required number plus one extra (correct in cases)\n // where the # of partitions is not evenly divisible by the\n // number of processors.\n counts.haveAdditionalPartition++;\n } else if (numberOfPartitions > minPartitionsPerOwner + 1) {\n // 3. has more than the possible # of partitions required\n counts.haveTooManyPartitions++;\n }\n }\n\n return counts;\n}\n\n/**\n * Validates that we are currently in a balanced state - all EventProcessors own the\n * minimum required number of partitions (and additional partitions, if the # of partitions\n * is not evenly divisible by the # of EventProcessors).\n *\n * @param requiredNumberOfOwnersWithExtraPartition - The # of EventProcessors that process an additional partition, in addition to the required minimum.\n * @param totalExpectedProcessors - The total # of EventProcessors we expect.\n * @param eventProcessorCounts - EventProcessor counts, grouped by criteria.\n * @internal\n */\nfunction isLoadBalanced(\n requiredNumberOfOwnersWithExtraPartition: number,\n totalExpectedEventProcessors: number,\n { haveAdditionalPartition, haveRequiredPartitions }: EventProcessorCounts,\n): boolean {\n return (\n haveAdditionalPartition === requiredNumberOfOwnersWithExtraPartition &&\n haveRequiredPartitions + haveAdditionalPartition === totalExpectedEventProcessors\n );\n}\n\n/**\n * Determines the number of new partitions to claim for this particular processor.\n *\n * @param minRequired - The minimum required number of partitions.\n * @param requiredNumberOfOwnersWithExtraPartition - The current number of processors that should have an additional partition.\n * @param numPartitionsOwnedByUs - The number of partitions we currently own.\n * @param eventProcessorCounts - Processors, grouped by criteria.\n * @internal\n */\nfunction getNumberOfPartitionsToClaim(\n minRequiredPartitionCount: number,\n requiredNumberOfOwnersWithExtraPartition: number,\n numPartitionsOwnedByUs: number,\n { haveAdditionalPartition, haveTooManyPartitions }: EventProcessorCounts,\n): number {\n let actualRequiredPartitionCount = minRequiredPartitionCount;\n\n if (\n requiredNumberOfOwnersWithExtraPartition > 0 &&\n // Eventually the `haveTooManyPartitions` will decay into `haveAdditionalPartition`\n // EventProcessors as partitions are balanced to consumers that aren't at par.\n // We can consider them to be `haveAdditionalPartition` EventProcessors for our purposes.\n haveAdditionalPartition + haveTooManyPartitions < requiredNumberOfOwnersWithExtraPartition\n ) {\n // Overall we don't have enough EventProcessors that are taking on an additional partition\n // so we should attempt to.\n actualRequiredPartitionCount = minRequiredPartitionCount + 1;\n }\n return actualRequiredPartitionCount - numPartitionsOwnedByUs;\n}\n\n/**\n * Determines which partitions can be stolen from other owners while maintaining\n * a balanced state.\n * @param numberOfPartitionsToClaim - The number of partitions the owner needs to claim to reach a balanced state.\n * @param minPartitionsPerOwner - The minimum number of partitions each owner needs for the partition load to be balanced.\n * @param requiredNumberOfOwnersWithExtraPartition - The number of owners that should have 1 extra partition.\n * @param ourOwnerId - The id of _our_ owner.\n * @param ownerToOwnershipMap - The current ownerships for partitions.\n * @internal\n */\nfunction findPartitionsToSteal(\n numberOfPartitionsToClaim: number,\n minPartitionsPerOwner: number,\n requiredNumberOfOwnersWithExtraPartition: number,\n ourOwnerId: string,\n ownerToOwnershipMap: Map<string, PartitionOwnership[]>,\n): string[] {\n const partitionsToSteal: string[] = [];\n // Create a list of PartitionOwnership lists that we can steal from.\n const listOfPartitionOwnerships: Array<PartitionOwnership[]> = [];\n ownerToOwnershipMap.forEach((partitionOwnerships, ownerId) => {\n if (ownerId === ourOwnerId || partitionOwnerships.length <= minPartitionsPerOwner) return;\n listOfPartitionOwnerships.push(partitionOwnerships);\n });\n\n // Sort the list in descending order based on the length of each element.\n listOfPartitionOwnerships.sort((a, b) => {\n if (a.length > b.length) return -1;\n if (a.length < b.length) return 1;\n return 0;\n });\n\n // Attempt to steal partitions from EventProcessors that have the most partitions 1st,\n // then work our way down.\n let ownersEncounteredWithExtraPartitions = 0;\n let currentPartitionOwnershipList = listOfPartitionOwnerships.shift();\n while (numberOfPartitionsToClaim > 0 && currentPartitionOwnershipList) {\n let ownersExpectedPartitionCount = minPartitionsPerOwner;\n // Determine if the current owner should be allowed to have an extra partition.\n if (ownersEncounteredWithExtraPartitions < requiredNumberOfOwnersWithExtraPartition) {\n ownersExpectedPartitionCount++;\n }\n ownersEncounteredWithExtraPartitions++;\n\n let numberAvailableToSteal =\n currentPartitionOwnershipList.length - ownersExpectedPartitionCount;\n // Claim as many random partitions as possible.\n while (Math.min(numberOfPartitionsToClaim, numberAvailableToSteal)) {\n const indexToClaim = Math.floor(Math.random() * currentPartitionOwnershipList.length);\n partitionsToSteal.push(currentPartitionOwnershipList.splice(indexToClaim, 1)[0].partitionId);\n numberOfPartitionsToClaim--;\n numberAvailableToSteal--;\n }\n\n // Move on to the next list of PartitionOwnership.\n currentPartitionOwnershipList = listOfPartitionOwnerships.shift();\n }\n\n return partitionsToSteal;\n}\n\n/**\n * Identifies all of the partitions that can be claimed by the specified owner for\n * that owner to reach a balanced state.\n * @param OwnerId - The id we should assume is _our_ id when checking for ownership.\n * @param claimedPartitionOwnershipMap - The current claimed ownerships for partitions.\n * @param partitionIds - Partitions to assign owners to.\n * @param expirationIntervalInMs - The length of time a partition claim is valid.\n * @returns Partition ids that may be claimed.\n * @internal\n */\nexport function listAvailablePartitions(\n ownerId: string,\n claimedPartitionOwnershipMap: Map<string, PartitionOwnership>,\n partitionIds: string[],\n expirationIntervalInMs: number,\n): string[] {\n if (!partitionIds.length) {\n return [];\n }\n\n // Collect only the PartitionOwnership that have been updated within the expiration interval.\n // Any PartitionOwnership that has been updated outside the expiration interval can be claimed.\n const activePartitionOwnershipMap = getActivePartitionOwnerships(\n claimedPartitionOwnershipMap,\n expirationIntervalInMs,\n );\n logger.verbose(\n `[${ownerId}] Number of active ownership records: ${activePartitionOwnershipMap.size}.`,\n );\n\n if (activePartitionOwnershipMap.size === 0) {\n // All partitions in this Event Hub are available to claim.\n return partitionIds;\n }\n\n // Map ownerIds to the partitions they own so that we can determine how many each owner has.\n const ownerToOwnershipMap = new Map<string, PartitionOwnership[]>();\n for (const activeOwnership of activePartitionOwnershipMap.values()) {\n const partitionOwnershipList = ownerToOwnershipMap.get(activeOwnership.ownerId) || [];\n\n partitionOwnershipList.push(activeOwnership);\n ownerToOwnershipMap.set(activeOwnership.ownerId, partitionOwnershipList);\n }\n\n // Add the current EventProcessor to the map of owners to ownerships if it doesn't exist.\n if (!ownerToOwnershipMap.has(ownerId)) {\n ownerToOwnershipMap.set(ownerId, []);\n }\n\n logger.info(`[${ownerId}] Number of active event processors: ${ownerToOwnershipMap.size}.`);\n\n const { minPartitionsPerOwner, requiredNumberOfOwnersWithExtraPartition } =\n calculateBalancedLoadCounts(ownerToOwnershipMap, partitionIds);\n\n logger.verbose(\n `[${ownerId}] Expected minimum number of partitions per event processor: ${minPartitionsPerOwner},` +\n `expected number of event processors with additional partition: ${requiredNumberOfOwnersWithExtraPartition}.`,\n );\n\n // Get some stats representing the current state the world with regards to how balanced the\n // partitions are across EventProcessors.\n const eventProcessorCounts = getEventProcessorCounts(minPartitionsPerOwner, ownerToOwnershipMap);\n\n if (\n isLoadBalanced(\n requiredNumberOfOwnersWithExtraPartition,\n ownerToOwnershipMap.size,\n eventProcessorCounts,\n )\n ) {\n // When the partitions are evenly distributed, no change required.\n return [];\n }\n\n let numberOfPartitionsToClaim = getNumberOfPartitionsToClaim(\n minPartitionsPerOwner,\n requiredNumberOfOwnersWithExtraPartition,\n ownerToOwnershipMap.get(ownerId)!.length,\n eventProcessorCounts,\n );\n\n if (numberOfPartitionsToClaim <= 0) {\n return [];\n }\n\n const partitionsToClaim: string[] = [];\n const unclaimedPartitionIds = partitionIds.filter((id) => !activePartitionOwnershipMap.has(id));\n\n // Prioritize getting unclaimed partitions first.\n while (Math.min(numberOfPartitionsToClaim, unclaimedPartitionIds.length)) {\n const indexToClaim = Math.floor(Math.random() * unclaimedPartitionIds.length);\n partitionsToClaim.push(unclaimedPartitionIds.splice(indexToClaim, 1)[0]);\n numberOfPartitionsToClaim--;\n }\n\n if (numberOfPartitionsToClaim === 0) {\n return partitionsToClaim;\n }\n\n // Find partitions that can be stolen from other EventProcessors.\n const partitionsToSteal = findPartitionsToSteal(\n numberOfPartitionsToClaim,\n minPartitionsPerOwner,\n requiredNumberOfOwnersWithExtraPartition,\n ownerId,\n ownerToOwnershipMap,\n );\n\n return partitionsToClaim.concat(partitionsToSteal);\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LoadBalancingStrategy } from "./loadBalancingStrategy.js";
|
|
2
|
+
import { PartitionOwnership } from "../eventProcessor.js";
|
|
3
|
+
/**
|
|
4
|
+
* The UnbalancedLoadBalancingStrategy does no actual load balancing.
|
|
5
|
+
* It is intended to be used when you want to avoid load balancing
|
|
6
|
+
* and consume a set of partitions.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class UnbalancedLoadBalancingStrategy implements LoadBalancingStrategy {
|
|
10
|
+
/**
|
|
11
|
+
* Implements load balancing by taking into account current ownership and
|
|
12
|
+
* the full set of partitions in the Event Hub.
|
|
13
|
+
* @param _ourOwnerId - The id we should assume is _our_ id when checking for ownership.
|
|
14
|
+
* @param _claimedPartitionOwnershipMap - The current claimed ownerships for partitions.
|
|
15
|
+
* @param partitionIds - Partitions to assign owners to.
|
|
16
|
+
* @returns Partition ids to claim.
|
|
17
|
+
*/
|
|
18
|
+
getPartitionsToClaim(_ourOwnerId: string, _claimedPartitionOwnershipMap: Map<string, PartitionOwnership>, partitionIds: string[]): string[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=unbalancedStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbalancedStrategy.d.ts","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/unbalancedStrategy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;GAKG;AACH,qBAAa,+BAAgC,YAAW,qBAAqB;IAC3E;;;;;;;OAOG;IACI,oBAAoB,CACzB,WAAW,EAAE,MAAM,EACnB,6BAA6B,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC9D,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE;CAGZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbalancedStrategy.js","sourceRoot":"","sources":["../../../src/loadBalancerStrategies/unbalancedStrategy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;;GAKG;AACH,MAAM,OAAO,+BAA+B;IAC1C;;;;;;;OAOG;IACI,oBAAoB,CACzB,WAAmB,EACnB,6BAA8D,EAC9D,YAAsB;QAEtB,OAAO,YAAY,CAAC;IACtB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LoadBalancingStrategy } from \"./loadBalancingStrategy.js\";\nimport { PartitionOwnership } from \"../eventProcessor.js\";\n\n/**\n * The UnbalancedLoadBalancingStrategy does no actual load balancing.\n * It is intended to be used when you want to avoid load balancing\n * and consume a set of partitions.\n * @internal\n */\nexport class UnbalancedLoadBalancingStrategy implements LoadBalancingStrategy {\n /**\n * Implements load balancing by taking into account current ownership and\n * the full set of partitions in the Event Hub.\n * @param _ourOwnerId - The id we should assume is _our_ id when checking for ownership.\n * @param _claimedPartitionOwnershipMap - The current claimed ownerships for partitions.\n * @param partitionIds - Partitions to assign owners to.\n * @returns Partition ids to claim.\n */\n public getPartitionsToClaim(\n _ourOwnerId: string,\n _claimedPartitionOwnershipMap: Map<string, PartitionOwnership>,\n partitionIds: string[],\n ): string[] {\n return partitionIds;\n }\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AzureLogger, Debugger } from "@azure/logger";
|
|
2
|
+
/**
|
|
3
|
+
* The `@azure/logger` configuration for this package.
|
|
4
|
+
* This will output logs using the `azure:event-hubs` namespace prefix.
|
|
5
|
+
*/
|
|
6
|
+
export declare const logger: AzureLogger;
|
|
7
|
+
/**
|
|
8
|
+
* Logs the error's stack trace to "verbose" if a stack trace is available.
|
|
9
|
+
* @param error - Error containing a stack trace.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function logErrorStackTrace(error: unknown): void;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function createReceiverLogPrefix(consumerId: string, connectionId: string, partitionId: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function createSenderLogPrefix(senderId: string, connectionId: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function createManagementLogPrefix(connectionId: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export type SimpleLogger = {
|
|
29
|
+
[Property in keyof AzureLogger]: Debugger["log"];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare function createSimpleLogger(azureLogger: AzureLogger, prefix: string): SimpleLogger;
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare function logObj(obj: unknown): void;
|
|
37
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAqC,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzF;;;GAGG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AAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAA8B,kBAAkB,EAAY,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAEvD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,sBAAsB,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAkB,EAClB,YAAoB,EACpB,WAAmB;IAEnB,OAAO,IAAI,YAAY,eAAe,WAAW,IAAI,UAAU,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,YAAoB;IAC1E,OAAO,IAAI,YAAY,YAAY,QAAQ,EAAE,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,YAAoB;IAC5D,OAAO,IAAI,YAAY,cAAc,CAAC;AACxC,CAAC;AASD,SAAS,iBAAiB,CACxB,WAAwB,EACxB,MAAc,EACd,KAAoB;IAEpB,OAAO,CAAC,GAAQ,EAAE,GAAG,IAAW,EAAE,EAAE,CAClC,WAAW,CAAC,KAAK,CAAC,CAChB,GAAG,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EACpE,GAAG,IAAI,CACR,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAwB,EAAE,MAAc;IACzE,OAAO;QACL,IAAI,EAAE,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC;QACpD,KAAK,EAAE,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;QACtD,OAAO,EAAE,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC;QAC1D,OAAO,EAAE,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC;KAC3D,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,MAAM,CAAC,GAAY;IACjC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureLogger, AzureLogLevel, createClientLogger, Debugger } from \"@azure/logger\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\n\n/**\n * The `@azure/logger` configuration for this package.\n * This will output logs using the `azure:event-hubs` namespace prefix.\n */\nexport const logger = createClientLogger(\"event-hubs\");\n\n/**\n * Logs the error's stack trace to \"verbose\" if a stack trace is available.\n * @param error - Error containing a stack trace.\n * @internal\n */\nexport function logErrorStackTrace(error: unknown): void {\n if (isObjectWithProperties(error, [\"stack\"])) {\n logger.verbose(error.stack);\n }\n}\n\n/**\n * @internal\n */\nexport function createReceiverLogPrefix(\n consumerId: string,\n connectionId: string,\n partitionId: string,\n): string {\n return `[${connectionId}] Receiver P${partitionId}-${consumerId}`;\n}\n\n/**\n * @internal\n */\nexport function createSenderLogPrefix(senderId: string, connectionId: string): string {\n return `[${connectionId}] Sender ${senderId}`;\n}\n\n/**\n * @internal\n */\nexport function createManagementLogPrefix(connectionId: string): string {\n return `[${connectionId}] Management`;\n}\n\n/**\n * @internal\n */\nexport type SimpleLogger = {\n [Property in keyof AzureLogger]: Debugger[\"log\"];\n};\n\nfunction createLogFunction(\n azureLogger: AzureLogger,\n prefix: string,\n level: AzureLogLevel,\n): (arg: any, ...args: any[]) => void {\n return (arg: any, ...args: any[]) =>\n azureLogger[level](\n ...(typeof arg === \"string\" ? [`${prefix}: ${arg}`] : [prefix, arg]),\n ...args,\n );\n}\n\n/**\n * @internal\n */\nexport function createSimpleLogger(azureLogger: AzureLogger, prefix: string): SimpleLogger {\n return {\n info: createLogFunction(azureLogger, prefix, \"info\"),\n error: createLogFunction(azureLogger, prefix, \"error\"),\n verbose: createLogFunction(azureLogger, prefix, \"verbose\"),\n warning: createLogFunction(azureLogger, prefix, \"warning\"),\n };\n}\n\n/** @internal */\nexport function logObj(obj: unknown): void {\n JSON.stringify(obj, undefined, 2);\n}\n"]}
|