@azure/event-hubs 6.0.2-alpha.20251015.1 → 6.0.2-alpha.20251021.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/dist/browser/batchingPartitionChannel.d.ts.map +1 -1
  2. package/dist/browser/batchingPartitionChannel.js +2 -1
  3. package/dist/browser/batchingPartitionChannel.js.map +1 -1
  4. package/dist/browser/connectionContext.d.ts.map +1 -1
  5. package/dist/browser/connectionContext.js +10 -4
  6. package/dist/browser/connectionContext.js.map +1 -1
  7. package/dist/browser/eventHubBufferedProducerClient.d.ts.map +1 -1
  8. package/dist/browser/eventHubBufferedProducerClient.js +2 -1
  9. package/dist/browser/eventHubBufferedProducerClient.js.map +1 -1
  10. package/dist/browser/eventHubConsumerClient.d.ts.map +1 -1
  11. package/dist/browser/eventHubConsumerClient.js +3 -6
  12. package/dist/browser/eventHubConsumerClient.js.map +1 -1
  13. package/dist/browser/eventHubProducerClient.d.ts.map +1 -1
  14. package/dist/browser/eventHubProducerClient.js +3 -6
  15. package/dist/browser/eventHubProducerClient.js.map +1 -1
  16. package/dist/browser/eventHubSender.d.ts.map +1 -1
  17. package/dist/browser/eventHubSender.js +6 -4
  18. package/dist/browser/eventHubSender.js.map +1 -1
  19. package/dist/browser/partitionReceiver.js +4 -4
  20. package/dist/browser/partitionReceiver.js.map +1 -1
  21. package/dist/browser/util/timerLoop.d.ts.map +1 -1
  22. package/dist/browser/util/timerLoop.js +12 -5
  23. package/dist/browser/util/timerLoop.js.map +1 -1
  24. package/dist/commonjs/batchingPartitionChannel.d.ts.map +1 -1
  25. package/dist/commonjs/batchingPartitionChannel.js +2 -1
  26. package/dist/commonjs/batchingPartitionChannel.js.map +1 -1
  27. package/dist/commonjs/connectionContext.d.ts.map +1 -1
  28. package/dist/commonjs/connectionContext.js +10 -4
  29. package/dist/commonjs/connectionContext.js.map +1 -1
  30. package/dist/commonjs/eventHubBufferedProducerClient.d.ts.map +1 -1
  31. package/dist/commonjs/eventHubBufferedProducerClient.js +2 -1
  32. package/dist/commonjs/eventHubBufferedProducerClient.js.map +1 -1
  33. package/dist/commonjs/eventHubConsumerClient.d.ts.map +1 -1
  34. package/dist/commonjs/eventHubConsumerClient.js +3 -6
  35. package/dist/commonjs/eventHubConsumerClient.js.map +1 -1
  36. package/dist/commonjs/eventHubProducerClient.d.ts.map +1 -1
  37. package/dist/commonjs/eventHubProducerClient.js +3 -6
  38. package/dist/commonjs/eventHubProducerClient.js.map +1 -1
  39. package/dist/commonjs/eventHubSender.d.ts.map +1 -1
  40. package/dist/commonjs/eventHubSender.js +6 -4
  41. package/dist/commonjs/eventHubSender.js.map +1 -1
  42. package/dist/commonjs/partitionReceiver.js +4 -4
  43. package/dist/commonjs/partitionReceiver.js.map +1 -1
  44. package/dist/commonjs/tsdoc-metadata.json +1 -1
  45. package/dist/commonjs/util/timerLoop.d.ts.map +1 -1
  46. package/dist/commonjs/util/timerLoop.js +12 -5
  47. package/dist/commonjs/util/timerLoop.js.map +1 -1
  48. package/dist/esm/batchingPartitionChannel.d.ts.map +1 -1
  49. package/dist/esm/batchingPartitionChannel.js +2 -1
  50. package/dist/esm/batchingPartitionChannel.js.map +1 -1
  51. package/dist/esm/connectionContext.d.ts.map +1 -1
  52. package/dist/esm/connectionContext.js +10 -4
  53. package/dist/esm/connectionContext.js.map +1 -1
  54. package/dist/esm/eventHubBufferedProducerClient.d.ts.map +1 -1
  55. package/dist/esm/eventHubBufferedProducerClient.js +2 -1
  56. package/dist/esm/eventHubBufferedProducerClient.js.map +1 -1
  57. package/dist/esm/eventHubConsumerClient.d.ts.map +1 -1
  58. package/dist/esm/eventHubConsumerClient.js +3 -6
  59. package/dist/esm/eventHubConsumerClient.js.map +1 -1
  60. package/dist/esm/eventHubProducerClient.d.ts.map +1 -1
  61. package/dist/esm/eventHubProducerClient.js +3 -6
  62. package/dist/esm/eventHubProducerClient.js.map +1 -1
  63. package/dist/esm/eventHubSender.d.ts.map +1 -1
  64. package/dist/esm/eventHubSender.js +6 -4
  65. package/dist/esm/eventHubSender.js.map +1 -1
  66. package/dist/esm/partitionReceiver.js +4 -4
  67. package/dist/esm/partitionReceiver.js.map +1 -1
  68. package/dist/esm/util/timerLoop.d.ts.map +1 -1
  69. package/dist/esm/util/timerLoop.js +12 -5
  70. package/dist/esm/util/timerLoop.js.map +1 -1
  71. package/dist/react-native/batchingPartitionChannel.d.ts +94 -0
  72. package/dist/react-native/batchingPartitionChannel.d.ts.map +1 -0
  73. package/dist/react-native/batchingPartitionChannel.js +255 -0
  74. package/dist/react-native/batchingPartitionChannel.js.map +1 -0
  75. package/dist/react-native/connectionContext.d.ts +108 -0
  76. package/dist/react-native/connectionContext.d.ts.map +1 -0
  77. package/dist/react-native/connectionContext.js +310 -0
  78. package/dist/react-native/connectionContext.js.map +1 -0
  79. package/dist/react-native/dataTransformer.d.ts +53 -0
  80. package/dist/react-native/dataTransformer.d.ts.map +1 -0
  81. package/dist/react-native/dataTransformer.js +133 -0
  82. package/dist/react-native/dataTransformer.js.map +1 -0
  83. package/dist/react-native/diagnostics/instrumentEventData.d.ts +28 -0
  84. package/dist/react-native/diagnostics/instrumentEventData.d.ts.map +1 -0
  85. package/dist/react-native/diagnostics/instrumentEventData.js +67 -0
  86. package/dist/react-native/diagnostics/instrumentEventData.js.map +1 -0
  87. package/dist/react-native/diagnostics/tracing.d.ts +19 -0
  88. package/dist/react-native/diagnostics/tracing.d.ts.map +1 -0
  89. package/dist/react-native/diagnostics/tracing.js +40 -0
  90. package/dist/react-native/diagnostics/tracing.js.map +1 -0
  91. package/dist/react-native/eventData.d.ts +295 -0
  92. package/dist/react-native/eventData.d.ts.map +1 -0
  93. package/dist/react-native/eventData.js +247 -0
  94. package/dist/react-native/eventData.js.map +1 -0
  95. package/dist/react-native/eventDataAdapter.d.ts +69 -0
  96. package/dist/react-native/eventDataAdapter.d.ts.map +1 -0
  97. package/dist/react-native/eventDataAdapter.js +38 -0
  98. package/dist/react-native/eventDataAdapter.js.map +1 -0
  99. package/dist/react-native/eventDataBatch.d.ts +225 -0
  100. package/dist/react-native/eventDataBatch.d.ts.map +1 -0
  101. package/dist/react-native/eventDataBatch.js +301 -0
  102. package/dist/react-native/eventDataBatch.js.map +1 -0
  103. package/dist/react-native/eventHubBufferedProducerClient.d.ts +323 -0
  104. package/dist/react-native/eventHubBufferedProducerClient.d.ts.map +1 -0
  105. package/dist/react-native/eventHubBufferedProducerClient.js +301 -0
  106. package/dist/react-native/eventHubBufferedProducerClient.js.map +1 -0
  107. package/dist/react-native/eventHubConsumerClient.d.ts +293 -0
  108. package/dist/react-native/eventHubConsumerClient.d.ts.map +1 -0
  109. package/dist/react-native/eventHubConsumerClient.js +336 -0
  110. package/dist/react-native/eventHubConsumerClient.js.map +1 -0
  111. package/dist/react-native/eventHubConsumerClientModels.d.ts +218 -0
  112. package/dist/react-native/eventHubConsumerClientModels.d.ts.map +1 -0
  113. package/dist/react-native/eventHubConsumerClientModels.js +4 -0
  114. package/dist/react-native/eventHubConsumerClientModels.js.map +1 -0
  115. package/dist/react-native/eventHubProducerClient.d.ts +299 -0
  116. package/dist/react-native/eventHubProducerClient.d.ts.map +1 -0
  117. package/dist/react-native/eventHubProducerClient.js +366 -0
  118. package/dist/react-native/eventHubProducerClient.js.map +1 -0
  119. package/dist/react-native/eventHubSender.d.ts +227 -0
  120. package/dist/react-native/eventHubSender.d.ts.map +1 -0
  121. package/dist/react-native/eventHubSender.js +626 -0
  122. package/dist/react-native/eventHubSender.js.map +1 -0
  123. package/dist/react-native/eventPosition.d.ts +73 -0
  124. package/dist/react-native/eventPosition.d.ts.map +1 -0
  125. package/dist/react-native/eventPosition.js +121 -0
  126. package/dist/react-native/eventPosition.js.map +1 -0
  127. package/dist/react-native/eventProcessor.d.ts +232 -0
  128. package/dist/react-native/eventProcessor.d.ts.map +1 -0
  129. package/dist/react-native/eventProcessor.js +389 -0
  130. package/dist/react-native/eventProcessor.js.map +1 -0
  131. package/dist/react-native/eventhubConnectionConfig.d.ts +96 -0
  132. package/dist/react-native/eventhubConnectionConfig.d.ts.map +1 -0
  133. package/dist/react-native/eventhubConnectionConfig.js +98 -0
  134. package/dist/react-native/eventhubConnectionConfig.js.map +1 -0
  135. package/dist/react-native/impl/awaitableQueue.d.ts +25 -0
  136. package/dist/react-native/impl/awaitableQueue.d.ts.map +1 -0
  137. package/dist/react-native/impl/awaitableQueue.js +51 -0
  138. package/dist/react-native/impl/awaitableQueue.js.map +1 -0
  139. package/dist/react-native/impl/partitionAssigner.d.ts +29 -0
  140. package/dist/react-native/impl/partitionAssigner.d.ts.map +1 -0
  141. package/dist/react-native/impl/partitionAssigner.js +52 -0
  142. package/dist/react-native/impl/partitionAssigner.js.map +1 -0
  143. package/dist/react-native/impl/partitionGate.d.ts +27 -0
  144. package/dist/react-native/impl/partitionGate.d.ts.map +1 -0
  145. package/dist/react-native/impl/partitionGate.js +38 -0
  146. package/dist/react-native/impl/partitionGate.js.map +1 -0
  147. package/dist/react-native/impl/partitionKeyToIdMapper.d.ts +6 -0
  148. package/dist/react-native/impl/partitionKeyToIdMapper.d.ts.map +1 -0
  149. package/dist/react-native/impl/partitionKeyToIdMapper.js +111 -0
  150. package/dist/react-native/impl/partitionKeyToIdMapper.js.map +1 -0
  151. package/dist/react-native/inMemoryCheckpointStore.d.ts +44 -0
  152. package/dist/react-native/inMemoryCheckpointStore.d.ts.map +1 -0
  153. package/dist/react-native/inMemoryCheckpointStore.js +94 -0
  154. package/dist/react-native/inMemoryCheckpointStore.js.map +1 -0
  155. package/dist/react-native/index.d.ts +21 -0
  156. package/dist/react-native/index.d.ts.map +1 -0
  157. package/dist/react-native/index.js +12 -0
  158. package/dist/react-native/index.js.map +1 -0
  159. package/dist/react-native/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
  160. package/dist/react-native/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
  161. package/dist/react-native/loadBalancerStrategies/balancedStrategy.js +40 -0
  162. package/dist/react-native/loadBalancerStrategies/balancedStrategy.js.map +1 -0
  163. package/dist/react-native/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
  164. package/dist/react-native/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
  165. package/dist/react-native/loadBalancerStrategies/greedyStrategy.js +29 -0
  166. package/dist/react-native/loadBalancerStrategies/greedyStrategy.js.map +1 -0
  167. package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
  168. package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
  169. package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.js +245 -0
  170. package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
  171. package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
  172. package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
  173. package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.js +22 -0
  174. package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
  175. package/dist/react-native/logger.d.ts +37 -0
  176. package/dist/react-native/logger.d.ts.map +1 -0
  177. package/dist/react-native/logger.js +56 -0
  178. package/dist/react-native/logger.js.map +1 -0
  179. package/dist/react-native/managementClient.d.ts +145 -0
  180. package/dist/react-native/managementClient.d.ts.map +1 -0
  181. package/dist/react-native/managementClient.js +305 -0
  182. package/dist/react-native/managementClient.js.map +1 -0
  183. package/dist/react-native/models/private.d.ts +185 -0
  184. package/dist/react-native/models/private.d.ts.map +1 -0
  185. package/dist/react-native/models/private.js +4 -0
  186. package/dist/react-native/models/private.js.map +1 -0
  187. package/dist/react-native/models/public.d.ts +240 -0
  188. package/dist/react-native/models/public.d.ts.map +1 -0
  189. package/dist/react-native/models/public.js +18 -0
  190. package/dist/react-native/models/public.js.map +1 -0
  191. package/dist/react-native/package.json +3 -0
  192. package/dist/react-native/partitionProcessor.d.ts +134 -0
  193. package/dist/react-native/partitionProcessor.d.ts.map +1 -0
  194. package/dist/react-native/partitionProcessor.js +137 -0
  195. package/dist/react-native/partitionProcessor.js.map +1 -0
  196. package/dist/react-native/partitionPump.d.ts +38 -0
  197. package/dist/react-native/partitionPump.d.ts.map +1 -0
  198. package/dist/react-native/partitionPump.js +175 -0
  199. package/dist/react-native/partitionPump.js.map +1 -0
  200. package/dist/react-native/partitionReceiver.d.ts +82 -0
  201. package/dist/react-native/partitionReceiver.d.ts.map +1 -0
  202. package/dist/react-native/partitionReceiver.js +335 -0
  203. package/dist/react-native/partitionReceiver.js.map +1 -0
  204. package/dist/react-native/pumpManager.d.ts +72 -0
  205. package/dist/react-native/pumpManager.d.ts.map +1 -0
  206. package/dist/react-native/pumpManager.js +120 -0
  207. package/dist/react-native/pumpManager.js.map +1 -0
  208. package/dist/react-native/util/connectionStringUtils.d.ts +52 -0
  209. package/dist/react-native/util/connectionStringUtils.d.ts.map +1 -0
  210. package/dist/react-native/util/connectionStringUtils.js +48 -0
  211. package/dist/react-native/util/connectionStringUtils.js.map +1 -0
  212. package/dist/react-native/util/constants.d.ts +25 -0
  213. package/dist/react-native/util/constants.d.ts.map +1 -0
  214. package/dist/react-native/util/constants.js +27 -0
  215. package/dist/react-native/util/constants.js.map +1 -0
  216. package/dist/react-native/util/delayWithoutThrow.d.ts +8 -0
  217. package/dist/react-native/util/delayWithoutThrow.d.ts.map +1 -0
  218. package/dist/react-native/util/delayWithoutThrow.js +17 -0
  219. package/dist/react-native/util/delayWithoutThrow.js.map +1 -0
  220. package/dist/react-native/util/error.d.ts +39 -0
  221. package/dist/react-native/util/error.d.ts.map +1 -0
  222. package/dist/react-native/util/error.js +103 -0
  223. package/dist/react-native/util/error.js.map +1 -0
  224. package/dist/react-native/util/getPromiseParts.d.ts +10 -0
  225. package/dist/react-native/util/getPromiseParts.d.ts.map +1 -0
  226. package/dist/react-native/util/getPromiseParts.js +20 -0
  227. package/dist/react-native/util/getPromiseParts.js.map +1 -0
  228. package/dist/react-native/util/operationOptions.d.ts +16 -0
  229. package/dist/react-native/util/operationOptions.d.ts.map +1 -0
  230. package/dist/react-native/util/operationOptions.js +4 -0
  231. package/dist/react-native/util/operationOptions.js.map +1 -0
  232. package/dist/react-native/util/parseEndpoint.d.ts +11 -0
  233. package/dist/react-native/util/parseEndpoint.d.ts.map +1 -0
  234. package/dist/react-native/util/parseEndpoint.js +17 -0
  235. package/dist/react-native/util/parseEndpoint.js.map +1 -0
  236. package/dist/react-native/util/retries.d.ts +6 -0
  237. package/dist/react-native/util/retries.d.ts.map +1 -0
  238. package/dist/react-native/util/retries.js +13 -0
  239. package/dist/react-native/util/retries.js.map +1 -0
  240. package/dist/react-native/util/runtimeInfo-react-native.d.mts.map +1 -0
  241. package/dist/react-native/util/runtimeInfo-react-native.mjs.map +1 -0
  242. package/dist/react-native/util/runtimeInfo.d.ts +6 -0
  243. package/dist/react-native/util/runtimeInfo.js +20 -0
  244. package/dist/react-native/util/timerLoop.d.ts +26 -0
  245. package/dist/react-native/util/timerLoop.d.ts.map +1 -0
  246. package/dist/react-native/util/timerLoop.js +34 -0
  247. package/dist/react-native/util/timerLoop.js.map +1 -0
  248. package/dist/react-native/util/typeGuards.d.ts +8 -0
  249. package/dist/react-native/util/typeGuards.d.ts.map +1 -0
  250. package/dist/react-native/util/typeGuards.js +12 -0
  251. package/dist/react-native/util/typeGuards.js.map +1 -0
  252. package/dist/react-native/util/utils.d.ts +7 -0
  253. package/dist/react-native/util/utils.d.ts.map +1 -0
  254. package/dist/react-native/util/utils.js +13 -0
  255. package/dist/react-native/util/utils.js.map +1 -0
  256. package/dist/react-native/withAuth.d.ts +25 -0
  257. package/dist/react-native/withAuth.d.ts.map +1 -0
  258. package/dist/react-native/withAuth.js +84 -0
  259. package/dist/react-native/withAuth.js.map +1 -0
  260. package/package.json +16 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventHubBufferedProducerClient.d.ts","sourceRoot":"","sources":["../../src/eventHubBufferedProducerClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA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AI,CAAC;IAa9D;;;;;;;;;;;;;;;;;OAiBG;IACG,YAAY,CAChB,KAAK,EAAE,SAAS,GAAG,oBAAoB,EACvC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC;IAkClB;;;;;;;;;;;;;;;;;OAiBG;IACG,aAAa,CACjB,MAAM,EAAE,SAAS,EAAE,GAAG,oBAAoB,EAAE,EAE5C,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC;IAQlB;;;;;;;OAOG;IACG,KAAK,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9D;;;;;;OAMG;IACH,qBAAqB,CAAC,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI9F;;;;;;;OAOG;IACH,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAI7E;;;;;;;OAOG;IACH,sBAAsB,CACpB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mBAAmB,CAAC;IAI/B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;OAEG;IACH,OAAO,CAAC,4BAA4B;YAStB,mBAAmB;YAWnB,4BAA4B;CAS3C"}
@@ -0,0 +1,301 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { EventHubProducerClient } from "./eventHubProducerClient.js";
4
+ import { isDefined } from "@azure/core-util";
5
+ import { isCredential } from "./util/typeGuards.js";
6
+ import { delay } from "@azure/core-amqp";
7
+ import { BatchingPartitionChannel } from "./batchingPartitionChannel.js";
8
+ import { PartitionAssigner } from "./impl/partitionAssigner.js";
9
+ import { logger } from "./logger.js";
10
+ import { getRandomName } from "./util/utils.js";
11
+ /**
12
+ * The `EventHubBufferedProducerClient`is used to publish events to a specific Event Hub.
13
+ *
14
+ * The `EventHubBufferedProducerClient` does not publish events immediately.
15
+ * Instead, events are buffered so they can be efficiently batched and published
16
+ * when the batch is full or the `maxWaitTimeInMs` has elapsed with no new events
17
+ * enqueued.
18
+ *
19
+ * Depending on the options specified when events are enqueued, they may be
20
+ * automatically assigned to a partition, grouped according to the specified partition key,
21
+ * or assigned a specifically requested partition.
22
+ *
23
+ * This model is intended to shift the burden of batch management from callers, at the cost of
24
+ * non-deterministic timing, for when events will be published. There are additional trade-offs
25
+ * to consider, as well:
26
+ * - If the application crashes, events in the buffer will not have been published. To prevent
27
+ * data loss, callers are encouraged to track publishing progress using the
28
+ * `onSendEventsSuccessHandler` and `onSendEventsErrorHandler` handlers.
29
+ * - Events specifying a partition key may be assigned a different partition than those using
30
+ * the same key with other producers.
31
+ * - In the unlikely event that a partition becomes temporarily unavailable, the
32
+ * `EventHubBufferedProducerClient` may take longer to recover than other producers.
33
+ *
34
+ * In scenarios where it is important to have events published immediately with a deterministic
35
+ * outcome, ensure that partition keys are assigned to a partition consistent with other
36
+ * publishers, or where maximizing availability is a requirement, using the
37
+ * `EventHubProducerClient` is recommended.
38
+ */
39
+ export class EventHubBufferedProducerClient {
40
+ /**
41
+ * Controls the `abortSignal` passed to each `BatchingPartitionChannel`.
42
+ * Used to signal when a channel should stop waiting for events.
43
+ */
44
+ _abortController = new AbortController();
45
+ /**
46
+ * Indicates whether the client has been explicitly closed.
47
+ */
48
+ _isClosed = false;
49
+ /**
50
+ * Handles assigning partitions.
51
+ */
52
+ _partitionAssigner = new PartitionAssigner();
53
+ /**
54
+ * The known partitionIds that will be used when assigning events to partitions.
55
+ */
56
+ _partitionIds = [];
57
+ /**
58
+ * The EventHubProducerClient to use when creating and sending batches to the Event Hub.
59
+ */
60
+ _producer;
61
+ /**
62
+ * Mapping of partitionIds to `BatchingPartitionChannels`.
63
+ * Each `BatchingPartitionChannel` handles buffering events and backpressure independently.
64
+ */
65
+ _partitionChannels = new Map();
66
+ /**
67
+ * The options passed by the user when creating the EventHubBufferedProducerClient instance.
68
+ */
69
+ _clientOptions;
70
+ /**
71
+ * The interval at which the background management operation should run.
72
+ */
73
+ _backgroundManagementInterval = 10000; // 10 seconds
74
+ /**
75
+ * Indicates whether the background management loop is running.
76
+ */
77
+ _isBackgroundManagementRunning = false;
78
+ /**
79
+ * @readonly
80
+ * The name of the Event Hub instance for which this client is created.
81
+ */
82
+ get eventHubName() {
83
+ return this._producer.eventHubName;
84
+ }
85
+ /**
86
+ * @readonly
87
+ * The fully qualified namespace of the Event Hub instance for which this client is created.
88
+ * This is likely to be similar to <yournamespace>.servicebus.windows.net.
89
+ */
90
+ get fullyQualifiedNamespace() {
91
+ return this._producer.fullyQualifiedNamespace;
92
+ }
93
+ /**
94
+ * The name used to identify this EventHubBufferedProducerClient.
95
+ * If not specified or empty, a random unique one will be generated.
96
+ */
97
+ identifier;
98
+ constructor(fullyQualifiedNamespaceOrConnectionString1, eventHubNameOrOptions2, credentialOrOptions3, options4) {
99
+ if (typeof eventHubNameOrOptions2 !== "string") {
100
+ this.identifier = eventHubNameOrOptions2.identifier ?? getRandomName();
101
+ this._producer = new EventHubProducerClient(fullyQualifiedNamespaceOrConnectionString1, {
102
+ ...eventHubNameOrOptions2,
103
+ identifier: this.identifier,
104
+ });
105
+ this._clientOptions = { ...eventHubNameOrOptions2 };
106
+ }
107
+ else if (!isCredential(credentialOrOptions3)) {
108
+ this.identifier = credentialOrOptions3?.identifier ?? getRandomName();
109
+ this._producer = new EventHubProducerClient(fullyQualifiedNamespaceOrConnectionString1, eventHubNameOrOptions2, { ...credentialOrOptions3, identifier: this.identifier });
110
+ this._clientOptions = { ...credentialOrOptions3 };
111
+ }
112
+ else {
113
+ this.identifier = options4?.identifier ?? getRandomName();
114
+ this._producer = new EventHubProducerClient(fullyQualifiedNamespaceOrConnectionString1, eventHubNameOrOptions2, credentialOrOptions3, { ...options4, identifier: this.identifier });
115
+ this._clientOptions = { ...options4 };
116
+ }
117
+ // setting internal idempotent publishing option on the standard producer.
118
+ this._producer._enableIdempotentRetries = this._clientOptions.enableIdempotentRetries;
119
+ }
120
+ /**
121
+ * Closes the AMQP connection to the Event Hub instance,
122
+ * returning a promise that will be resolved when disconnection is completed.
123
+ *
124
+ * This will wait for enqueued events to be flushed to the service before closing
125
+ * the connection.
126
+ * To close without flushing, set the `flush` option to `false`.
127
+ *
128
+ * @param options - The set of options to apply to the operation call.
129
+ * @returns Promise<void>
130
+ * @throws Error if the underlying connection encounters an error while closing.
131
+ */
132
+ async close(options = {}) {
133
+ logger.verbose("closing buffered producer client...");
134
+ if (!isDefined(options.flush) || options.flush === true) {
135
+ await this.flush(options);
136
+ }
137
+ // Calling abort signals to the BatchingPartitionChannels that they
138
+ // should stop reading/sending events, and to the background management
139
+ // loop that it should stop periodic partition id updates.
140
+ this._abortController.abort();
141
+ await this._producer.close();
142
+ this._isClosed = true;
143
+ }
144
+ /**
145
+ * Enqueues an event into the buffer to be published to the Event Hub.
146
+ * If there is no capacity in the buffer when this method is invoked,
147
+ * it will wait for space to become available and ensure that the event
148
+ * has been enqueued.
149
+ *
150
+ * When this call returns, the event has been accepted into the buffer,
151
+ * but it may not have been published yet.
152
+ * Publishing will take place at a nondeterministic point in the future as the buffer is processed.
153
+ *
154
+ * @param events - An {@link EventData} or `AmqpAnnotatedMessage`.
155
+ * @param options - A set of options that can be specified to influence the way in which
156
+ * the event is sent to the associated Event Hub.
157
+ * - `abortSignal` : A signal used to cancel the enqueueEvent operation.
158
+ * - `partitionId` : The partition this set of events will be sent to. If set, `partitionKey` can not be set.
159
+ * - `partitionKey` : A value that is hashed to produce a partition assignment. If set, `partitionId` can not be set.
160
+ * @returns The total number of events that are currently buffered and waiting to be published, across all partitions.
161
+ */
162
+ async enqueueEvent(event, options = {}) {
163
+ if (this._isClosed) {
164
+ throw new Error(`This EventHubBufferedProducerClient has already been closed. Create a new client to enqueue events.`);
165
+ }
166
+ if (!this._partitionIds.length) {
167
+ await this._updatePartitionIds();
168
+ }
169
+ if (!this._isBackgroundManagementRunning) {
170
+ // Fire-and-forget background loop with error handling
171
+ this._startPartitionIdsUpdateLoop().catch((e) => {
172
+ logger.error(`The following error occurred during partition ID update loop: ${JSON.stringify(e, undefined, " ")}`);
173
+ });
174
+ this._isBackgroundManagementRunning = true;
175
+ }
176
+ const partitionId = this._partitionAssigner.assignPartition({
177
+ partitionId: options.partitionId,
178
+ partitionKey: options.partitionKey,
179
+ });
180
+ const partitionChannel = this._getPartitionChannel(partitionId);
181
+ await partitionChannel.enqueueEvent(event);
182
+ return this._getTotalBufferedEventsCount();
183
+ }
184
+ /**
185
+ * Enqueues events into the buffer to be published to the Event Hub.
186
+ * If there is no capacity in the buffer when this method is invoked,
187
+ * it will wait for space to become available and ensure that the events
188
+ * have been enqueued.
189
+ *
190
+ * When this call returns, the events have been accepted into the buffer,
191
+ * but it may not have been published yet.
192
+ * Publishing will take place at a nondeterministic point in the future as the buffer is processed.
193
+ *
194
+ * @param events - An array of {@link EventData} or `AmqpAnnotatedMessage`.
195
+ * @param options - A set of options that can be specified to influence the way in which
196
+ * events are sent to the associated Event Hub.
197
+ * - `abortSignal` : A signal used to cancel the enqueueEvents operation.
198
+ * - `partitionId` : The partition this set of events will be sent to. If set, `partitionKey` can not be set.
199
+ * - `partitionKey` : A value that is hashed to produce a partition assignment. If set, `partitionId` can not be set.
200
+ * @returns The total number of events that are currently buffered and waiting to be published, across all partitions.
201
+ */
202
+ async enqueueEvents(events,
203
+ // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
204
+ options = {}) {
205
+ for (const event of events) {
206
+ await this.enqueueEvent(event, options);
207
+ }
208
+ return this._getTotalBufferedEventsCount();
209
+ }
210
+ /**
211
+ * Attempts to publish all events in the buffer immediately.
212
+ * This may result in multiple batches being published,
213
+ * the outcome of each of which will be individually reported by
214
+ * the `onSendEventsSuccessHandler` and `onSendEventsErrorHandler` handlers.
215
+ *
216
+ * @param options - The set of options to apply to the operation call.
217
+ */
218
+ async flush(options = {}) {
219
+ await Promise.all(Array.from(this._partitionChannels.values()).map((channel) => channel.flush(options)));
220
+ }
221
+ /**
222
+ * Provides the Event Hub runtime information.
223
+ * @param options - The set of options to apply to the operation call.
224
+ * @returns A promise that resolves with information about the Event Hub instance.
225
+ * @throws Error if the underlying connection has been closed, create a new EventHubBufferedProducerClient.
226
+ * @throws AbortError if the operation is cancelled via the abortSignal.
227
+ */
228
+ getEventHubProperties(options = {}) {
229
+ return this._producer.getEventHubProperties(options);
230
+ }
231
+ /**
232
+ * Provides the id for each partition associated with the Event Hub.
233
+ * @param options - The set of options to apply to the operation call.
234
+ * @returns A promise that resolves with an Array of strings representing the id for
235
+ * each partition associated with the Event Hub.
236
+ * @throws Error if the underlying connection has been closed, create a new EventHubBufferedProducerClient.
237
+ * @throws AbortError if the operation is cancelled via the abortSignal.
238
+ */
239
+ getPartitionIds(options = {}) {
240
+ return this._producer.getPartitionIds(options);
241
+ }
242
+ /**
243
+ * Provides information about the state of the specified partition.
244
+ * @param partitionId - The id of the partition for which information is required.
245
+ * @param options - The set of options to apply to the operation call.
246
+ * @returns A promise that resolves with information about the state of the partition .
247
+ * @throws Error if the underlying connection has been closed, create a new EventHubBufferedProducerClient.
248
+ * @throws AbortError if the operation is cancelled via the abortSignal.
249
+ */
250
+ getPartitionProperties(partitionId, options = {}) {
251
+ return this._producer.getPartitionProperties(partitionId, options);
252
+ }
253
+ /**
254
+ * Gets the `BatchingPartitionChannel` associated with the partitionId.
255
+ *
256
+ * If one does not exist, it is created.
257
+ */
258
+ _getPartitionChannel(partitionId) {
259
+ const partitionChannel = this._partitionChannels.get(partitionId) ??
260
+ new BatchingPartitionChannel({
261
+ loopAbortSignal: this._abortController.signal,
262
+ maxBufferSize: this._clientOptions.maxEventBufferLengthPerPartition || 1500,
263
+ maxWaitTimeInMs: this._clientOptions.maxWaitTimeInMs || 1000,
264
+ onSendEventsErrorHandler: this._clientOptions.onSendEventsErrorHandler,
265
+ onSendEventsSuccessHandler: this._clientOptions.onSendEventsSuccessHandler,
266
+ partitionId,
267
+ producer: this._producer,
268
+ });
269
+ this._partitionChannels.set(partitionId, partitionChannel);
270
+ return partitionChannel;
271
+ }
272
+ /**
273
+ * Returns the total number of buffered events across all partitions.
274
+ */
275
+ _getTotalBufferedEventsCount() {
276
+ let total = 0;
277
+ for (const [_, channel] of this._partitionChannels) {
278
+ total += channel.getCurrentBufferedCount();
279
+ }
280
+ return total;
281
+ }
282
+ async _updatePartitionIds() {
283
+ logger.verbose("Checking for partition Id updates...");
284
+ const queriedPartitionIds = await this.getPartitionIds();
285
+ if (this._partitionIds.length !== queriedPartitionIds.length) {
286
+ logger.verbose("Applying partition Id updates");
287
+ this._partitionIds = queriedPartitionIds;
288
+ this._partitionAssigner.setPartitionIds(this._partitionIds);
289
+ }
290
+ }
291
+ async _startPartitionIdsUpdateLoop() {
292
+ logger.verbose("Starting a background loop to check and apply partition id updates...");
293
+ while (!this._abortController.signal.aborted && !this._isClosed) {
294
+ await delay(this._backgroundManagementInterval);
295
+ if (!this._isClosed) {
296
+ await this._updatePartitionIds();
297
+ }
298
+ }
299
+ }
300
+ }
301
+ //# sourceMappingURL=eventHubBufferedProducerClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventHubBufferedProducerClient.js","sourceRoot":"","sources":["../../src/eventHubBufferedProducerClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAWrE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAi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GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;QAC3D,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,4BAA4B;QAClC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACnD,KAAK,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QAC7C,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC/B,MAAM,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;QACvD,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAEzD,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,mBAAmB,CAAC,MAAM,EAAE,CAAC;YAC7D,MAAM,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;YAChD,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAAC;YACzC,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,4BAA4B;QACxC,MAAM,CAAC,OAAO,CAAC,uEAAuE,CAAC,CAAC;QACxF,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAChE,MAAM,KAAK,CAAO,IAAI,CAAC,6BAA6B,CAAC,CAAC;YACtD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { EventData } from \"./eventData.js\";\nimport { EventHubProducerClient } from \"./eventHubProducerClient.js\";\nimport type { OperationOptions } from \"./util/operationOptions.js\";\nimport type {\n EventHubClientOptions,\n GetEventHubPropertiesOptions,\n GetPartitionIdsOptions,\n GetPartitionPropertiesOptions,\n SendBatchOptions,\n} from \"./models/public.js\";\nimport type { EventHubProperties, PartitionProperties } from \"./managementClient.js\";\nimport type { NamedKeyCredential, SASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isDefined } from \"@azure/core-util\";\nimport { isCredential } from \"./util/typeGuards.js\";\nimport type { AmqpAnnotatedMessage } from \"@azure/core-amqp\";\nimport { delay } from \"@azure/core-amqp\";\nimport { BatchingPartitionChannel } from \"./batchingPartitionChannel.js\";\nimport { PartitionAssigner } from \"./impl/partitionAssigner.js\";\nimport { logger } from \"./logger.js\";\nimport { getRandomName } from \"./util/utils.js\";\n\n/**\n * Contains the events that were successfully sent to the Event Hub,\n * and the partition they were assigned to.\n */\nexport interface OnSendEventsSuccessContext {\n /**\n * The partition each event was assigned.\n */\n partitionId: string;\n /**\n * The array of {@link EventData} and/or `AmqpAnnotatedMessage` that were successfully sent to the Event Hub.\n */\n events: Array<EventData | AmqpAnnotatedMessage>;\n}\n\n/**\n * Contains the events that were not successfully sent to the Event Hub,\n * the partition they were assigned to, and the error that was encountered while sending.\n */\nexport interface OnSendEventsErrorContext {\n /**\n * The partition each event was assigned.\n */\n partitionId: string;\n /**\n * The array of {@link EventData} and/or `AmqpAnnotatedMessage` that were not successfully sent to the Event Hub.\n */\n events: Array<EventData | AmqpAnnotatedMessage>;\n /**\n * The error that occurred when sending the associated events to the Event Hub.\n */\n error: Error;\n}\n\n/**\n * Describes the options that can be provided while creating the `EventHubBufferedProducerClient`.\n */\nexport interface EventHubBufferedProducerClientOptions extends EventHubClientOptions {\n /**\n * The total number of events that can be buffered for publishing at a given time for a given partition.\n *\n * Default: 1500\n */\n maxEventBufferLengthPerPartition?: number;\n /**\n * The amount of time to wait for a new event to be enqueued in the buffer before publishing a partially full batch.\n *\n * Default: 1 second.\n */\n maxWaitTimeInMs?: number;\n /**\n * The handler to call once a batch has successfully published.\n */\n onSendEventsSuccessHandler?: (ctx: OnSendEventsSuccessContext) => void;\n /**\n * The handler to call when a batch fails to publish.\n */\n onSendEventsErrorHandler: (ctx: OnSendEventsErrorContext) => void;\n /**\n * Indicates whether or not the EventHubProducerClient should enable idempotent publishing to Event Hub partitions.\n * If enabled, the producer will only be able to publish directly to partitions;\n * it will not be able to publish to the Event Hubs gateway for automatic partition routing\n * nor will it be able to use a partition key.\n * Default: false\n */\n enableIdempotentRetries?: boolean;\n}\n\n/**\n * Options to configure the `flush` method on the `EventHubBufferedProducerClient`.\n */\nexport interface BufferedFlushOptions extends OperationOptions {}\n\n/**\n * Options to configure the `close` method on the `EventHubBufferedProducerClient`.\n */\nexport interface BufferedCloseOptions extends OperationOptions {\n /**\n * When `true`, all buffered events that are pending should be sent before closing.\n * When `false`, abandon all buffered events and close immediately.\n * Defaults to `true`.\n */\n flush?: boolean;\n}\n\n/**\n * Options to configure the `enqueueEvents` method on the `EventHubBufferedProducerClient`.\n */\nexport interface EnqueueEventOptions extends SendBatchOptions {}\n\n/**\n * The `EventHubBufferedProducerClient`is used to publish events to a specific Event Hub.\n *\n * The `EventHubBufferedProducerClient` does not publish events immediately.\n * Instead, events are buffered so they can be efficiently batched and published\n * when the batch is full or the `maxWaitTimeInMs` has elapsed with no new events\n * enqueued.\n *\n * Depending on the options specified when events are enqueued, they may be\n * automatically assigned to a partition, grouped according to the specified partition key,\n * or assigned a specifically requested partition.\n *\n * This model is intended to shift the burden of batch management from callers, at the cost of\n * non-deterministic timing, for when events will be published. There are additional trade-offs\n * to consider, as well:\n * - If the application crashes, events in the buffer will not have been published. To prevent\n * data loss, callers are encouraged to track publishing progress using the\n * `onSendEventsSuccessHandler` and `onSendEventsErrorHandler` handlers.\n * - Events specifying a partition key may be assigned a different partition than those using\n * the same key with other producers.\n * - In the unlikely event that a partition becomes temporarily unavailable, the\n * `EventHubBufferedProducerClient` may take longer to recover than other producers.\n *\n * In scenarios where it is important to have events published immediately with a deterministic\n * outcome, ensure that partition keys are assigned to a partition consistent with other\n * publishers, or where maximizing availability is a requirement, using the\n * `EventHubProducerClient` is recommended.\n */\nexport class EventHubBufferedProducerClient {\n /**\n * Controls the `abortSignal` passed to each `BatchingPartitionChannel`.\n * Used to signal when a channel should stop waiting for events.\n */\n private _abortController = new AbortController();\n\n /**\n * Indicates whether the client has been explicitly closed.\n */\n private _isClosed: boolean = false;\n\n /**\n * Handles assigning partitions.\n */\n private _partitionAssigner = new PartitionAssigner();\n\n /**\n * The known partitionIds that will be used when assigning events to partitions.\n */\n private _partitionIds: string[] = [];\n\n /**\n * The EventHubProducerClient to use when creating and sending batches to the Event Hub.\n */\n private _producer: EventHubProducerClient;\n\n /**\n * Mapping of partitionIds to `BatchingPartitionChannels`.\n * Each `BatchingPartitionChannel` handles buffering events and backpressure independently.\n */\n private _partitionChannels = new Map<string, BatchingPartitionChannel>();\n\n /**\n * The options passed by the user when creating the EventHubBufferedProducerClient instance.\n */\n private _clientOptions: EventHubBufferedProducerClientOptions;\n\n /**\n * The interval at which the background management operation should run.\n */\n private _backgroundManagementInterval = 10000; // 10 seconds\n\n /**\n * Indicates whether the background management loop is running.\n */\n private _isBackgroundManagementRunning = false;\n\n /**\n * @readonly\n * The name of the Event Hub instance for which this client is created.\n */\n get eventHubName(): string {\n return this._producer.eventHubName;\n }\n\n /**\n * @readonly\n * The fully qualified namespace of the Event Hub instance for which this client is created.\n * This is likely to be similar to <yournamespace>.servicebus.windows.net.\n */\n get fullyQualifiedNamespace(): string {\n return this._producer.fullyQualifiedNamespace;\n }\n\n /**\n * The name used to identify this EventHubBufferedProducerClient.\n * If not specified or empty, a random unique one will be generated.\n */\n public readonly identifier: string;\n\n /**\n * The `EventHubBufferedProducerClient` class is used to send events to an Event Hub.\n * Use the `options` parmeter to configure retry policy or proxy settings.\n * @param connectionString - The connection string to use for connecting to the Event Hub instance.\n * It is expected that the shared key properties and the Event Hub path are contained in this connection string.\n * e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n * - `userAgent` : A string to append to the built in user agent string that is passed to the service.\n */\n constructor(connectionString: string, options: EventHubBufferedProducerClientOptions);\n /**\n * The `EventHubBufferedProducerClient` class is used to send events to an Event Hub.\n * Use the `options` parmeter to configure retry policy or proxy settings.\n * @param connectionString - The connection string to use for connecting to the Event Hubs namespace.\n * It is expected that the shared key properties are contained in this connection string, but not the Event Hub path,\n * e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;'.\n * @param eventHubName - The name of the specific Event Hub to connect the client to.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n * - `userAgent` : A string to append to the built in user agent string that is passed to the service.\n */\n constructor(\n connectionString: string,\n eventHubName: string,\n options: EventHubBufferedProducerClientOptions,\n );\n /**\n * The `EventHubBufferedProducerClient` class is used to send events to an Event Hub.\n * Use the `options` parmeter to configure retry policy or proxy settings.\n * @param fullyQualifiedNamespace - The full namespace which is likely to be similar to\n * <yournamespace>.servicebus.windows.net\n * @param eventHubName - The name of the specific Event Hub to connect the client to.\n * @param credential - An credential object used by the client to get the token to authenticate the connection\n * with the Azure Event Hubs service.\n * See &commat;azure/identity for creating credentials that support AAD auth.\n * Use the `AzureNamedKeyCredential` from &commat;azure/core-auth if you want to pass in a `SharedAccessKeyName`\n * and `SharedAccessKey` without using a connection string. These fields map to the `name` and `key` field respectively\n * in `AzureNamedKeyCredential`.\n * Use the `AzureSASCredential` from &commat;azure/core-auth if you want to pass in a `SharedAccessSignature`\n * without using a connection string. This field maps to `signature` in `AzureSASCredential`.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n * - `userAgent` : A string to append to the built in user agent string that is passed to the service.\n */\n constructor(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n credential: TokenCredential | NamedKeyCredential | SASCredential,\n options: EventHubBufferedProducerClientOptions,\n );\n constructor(\n fullyQualifiedNamespaceOrConnectionString1: string,\n eventHubNameOrOptions2: string | EventHubBufferedProducerClientOptions,\n credentialOrOptions3?:\n | TokenCredential\n | NamedKeyCredential\n | SASCredential\n | EventHubBufferedProducerClientOptions,\n options4?: EventHubBufferedProducerClientOptions,\n ) {\n if (typeof eventHubNameOrOptions2 !== \"string\") {\n this.identifier = eventHubNameOrOptions2.identifier ?? getRandomName();\n this._producer = new EventHubProducerClient(fullyQualifiedNamespaceOrConnectionString1, {\n ...eventHubNameOrOptions2,\n identifier: this.identifier,\n });\n this._clientOptions = { ...eventHubNameOrOptions2 };\n } else if (!isCredential(credentialOrOptions3)) {\n this.identifier = credentialOrOptions3?.identifier ?? getRandomName();\n this._producer = new EventHubProducerClient(\n fullyQualifiedNamespaceOrConnectionString1,\n eventHubNameOrOptions2,\n { ...credentialOrOptions3, identifier: this.identifier },\n );\n this._clientOptions = { ...credentialOrOptions3! };\n } else {\n this.identifier = options4?.identifier ?? getRandomName();\n this._producer = new EventHubProducerClient(\n fullyQualifiedNamespaceOrConnectionString1,\n eventHubNameOrOptions2,\n credentialOrOptions3,\n { ...options4, identifier: this.identifier },\n );\n this._clientOptions = { ...options4! };\n }\n // setting internal idempotent publishing option on the standard producer.\n (this._producer as any)._enableIdempotentRetries = this._clientOptions.enableIdempotentRetries;\n }\n\n /**\n * Closes the AMQP connection to the Event Hub instance,\n * returning a promise that will be resolved when disconnection is completed.\n *\n * This will wait for enqueued events to be flushed to the service before closing\n * the connection.\n * To close without flushing, set the `flush` option to `false`.\n *\n * @param options - The set of options to apply to the operation call.\n * @returns Promise<void>\n * @throws Error if the underlying connection encounters an error while closing.\n */\n async close(options: BufferedCloseOptions = {}): Promise<void> {\n logger.verbose(\"closing buffered producer client...\");\n if (!isDefined(options.flush) || options.flush === true) {\n await this.flush(options);\n }\n // Calling abort signals to the BatchingPartitionChannels that they\n // should stop reading/sending events, and to the background management\n // loop that it should stop periodic partition id updates.\n this._abortController.abort();\n await this._producer.close();\n this._isClosed = true;\n }\n\n /**\n * Enqueues an event into the buffer to be published to the Event Hub.\n * If there is no capacity in the buffer when this method is invoked,\n * it will wait for space to become available and ensure that the event\n * has been enqueued.\n *\n * When this call returns, the event has been accepted into the buffer,\n * but it may not have been published yet.\n * Publishing will take place at a nondeterministic point in the future as the buffer is processed.\n *\n * @param events - An {@link EventData} or `AmqpAnnotatedMessage`.\n * @param options - A set of options that can be specified to influence the way in which\n * the event is sent to the associated Event Hub.\n * - `abortSignal` : A signal used to cancel the enqueueEvent operation.\n * - `partitionId` : The partition this set of events will be sent to. If set, `partitionKey` can not be set.\n * - `partitionKey` : A value that is hashed to produce a partition assignment. If set, `partitionId` can not be set.\n * @returns The total number of events that are currently buffered and waiting to be published, across all partitions.\n */\n async enqueueEvent(\n event: EventData | AmqpAnnotatedMessage,\n options: EnqueueEventOptions = {},\n ): Promise<number> {\n if (this._isClosed) {\n throw new Error(\n `This EventHubBufferedProducerClient has already been closed. Create a new client to enqueue events.`,\n );\n }\n\n if (!this._partitionIds.length) {\n await this._updatePartitionIds();\n }\n if (!this._isBackgroundManagementRunning) {\n // Fire-and-forget background loop with error handling\n this._startPartitionIdsUpdateLoop().catch((e) => {\n logger.error(\n `The following error occurred during partition ID update loop: ${JSON.stringify(\n e,\n undefined,\n \" \",\n )}`,\n );\n });\n this._isBackgroundManagementRunning = true;\n }\n\n const partitionId = this._partitionAssigner.assignPartition({\n partitionId: options.partitionId,\n partitionKey: options.partitionKey,\n });\n\n const partitionChannel = this._getPartitionChannel(partitionId);\n await partitionChannel.enqueueEvent(event);\n return this._getTotalBufferedEventsCount();\n }\n\n /**\n * Enqueues events into the buffer to be published to the Event Hub.\n * If there is no capacity in the buffer when this method is invoked,\n * it will wait for space to become available and ensure that the events\n * have been enqueued.\n *\n * When this call returns, the events have been accepted into the buffer,\n * but it may not have been published yet.\n * Publishing will take place at a nondeterministic point in the future as the buffer is processed.\n *\n * @param events - An array of {@link EventData} or `AmqpAnnotatedMessage`.\n * @param options - A set of options that can be specified to influence the way in which\n * events are sent to the associated Event Hub.\n * - `abortSignal` : A signal used to cancel the enqueueEvents operation.\n * - `partitionId` : The partition this set of events will be sent to. If set, `partitionKey` can not be set.\n * - `partitionKey` : A value that is hashed to produce a partition assignment. If set, `partitionId` can not be set.\n * @returns The total number of events that are currently buffered and waiting to be published, across all partitions.\n */\n async enqueueEvents(\n events: EventData[] | AmqpAnnotatedMessage[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: EnqueueEventOptions = {},\n ): Promise<number> {\n for (const event of events) {\n await this.enqueueEvent(event, options);\n }\n\n return this._getTotalBufferedEventsCount();\n }\n\n /**\n * Attempts to publish all events in the buffer immediately.\n * This may result in multiple batches being published,\n * the outcome of each of which will be individually reported by\n * the `onSendEventsSuccessHandler` and `onSendEventsErrorHandler` handlers.\n *\n * @param options - The set of options to apply to the operation call.\n */\n async flush(options: BufferedFlushOptions = {}): Promise<void> {\n await Promise.all(\n Array.from(this._partitionChannels.values()).map((channel) => channel.flush(options)),\n );\n }\n\n /**\n * Provides the Event Hub runtime information.\n * @param options - The set of options to apply to the operation call.\n * @returns A promise that resolves with information about the Event Hub instance.\n * @throws Error if the underlying connection has been closed, create a new EventHubBufferedProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n getEventHubProperties(options: GetEventHubPropertiesOptions = {}): Promise<EventHubProperties> {\n return this._producer.getEventHubProperties(options);\n }\n\n /**\n * Provides the id for each partition associated with the Event Hub.\n * @param options - The set of options to apply to the operation call.\n * @returns A promise that resolves with an Array of strings representing the id for\n * each partition associated with the Event Hub.\n * @throws Error if the underlying connection has been closed, create a new EventHubBufferedProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n getPartitionIds(options: GetPartitionIdsOptions = {}): Promise<Array<string>> {\n return this._producer.getPartitionIds(options);\n }\n\n /**\n * Provides information about the state of the specified partition.\n * @param partitionId - The id of the partition for which information is required.\n * @param options - The set of options to apply to the operation call.\n * @returns A promise that resolves with information about the state of the partition .\n * @throws Error if the underlying connection has been closed, create a new EventHubBufferedProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n getPartitionProperties(\n partitionId: string,\n options: GetPartitionPropertiesOptions = {},\n ): Promise<PartitionProperties> {\n return this._producer.getPartitionProperties(partitionId, options);\n }\n\n /**\n * Gets the `BatchingPartitionChannel` associated with the partitionId.\n *\n * If one does not exist, it is created.\n */\n private _getPartitionChannel(partitionId: string): BatchingPartitionChannel {\n const partitionChannel =\n this._partitionChannels.get(partitionId) ??\n new BatchingPartitionChannel({\n loopAbortSignal: this._abortController.signal,\n maxBufferSize: this._clientOptions.maxEventBufferLengthPerPartition || 1500,\n maxWaitTimeInMs: this._clientOptions.maxWaitTimeInMs || 1000,\n onSendEventsErrorHandler: this._clientOptions.onSendEventsErrorHandler,\n onSendEventsSuccessHandler: this._clientOptions.onSendEventsSuccessHandler,\n partitionId,\n producer: this._producer,\n });\n this._partitionChannels.set(partitionId, partitionChannel);\n return partitionChannel;\n }\n\n /**\n * Returns the total number of buffered events across all partitions.\n */\n private _getTotalBufferedEventsCount(): number {\n let total = 0;\n for (const [_, channel] of this._partitionChannels) {\n total += channel.getCurrentBufferedCount();\n }\n\n return total;\n }\n\n private async _updatePartitionIds(): Promise<void> {\n logger.verbose(\"Checking for partition Id updates...\");\n const queriedPartitionIds = await this.getPartitionIds();\n\n if (this._partitionIds.length !== queriedPartitionIds.length) {\n logger.verbose(\"Applying partition Id updates\");\n this._partitionIds = queriedPartitionIds;\n this._partitionAssigner.setPartitionIds(this._partitionIds);\n }\n }\n\n private async _startPartitionIdsUpdateLoop(): Promise<void> {\n logger.verbose(\"Starting a background loop to check and apply partition id updates...\");\n while (!this._abortController.signal.aborted && !this._isClosed) {\n await delay<void>(this._backgroundManagementInterval);\n if (!this._isClosed) {\n await this._updatePartitionIds();\n }\n }\n }\n}\n"]}