@azure/event-hubs 6.0.2-alpha.20251014.1 → 6.0.2-alpha.20251021.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/batchingPartitionChannel.d.ts.map +1 -1
- package/dist/browser/batchingPartitionChannel.js +2 -1
- package/dist/browser/batchingPartitionChannel.js.map +1 -1
- package/dist/browser/connectionContext.d.ts.map +1 -1
- package/dist/browser/connectionContext.js +10 -4
- package/dist/browser/connectionContext.js.map +1 -1
- package/dist/browser/eventHubBufferedProducerClient.d.ts.map +1 -1
- package/dist/browser/eventHubBufferedProducerClient.js +2 -1
- package/dist/browser/eventHubBufferedProducerClient.js.map +1 -1
- package/dist/browser/eventHubConsumerClient.d.ts.map +1 -1
- package/dist/browser/eventHubConsumerClient.js +3 -6
- package/dist/browser/eventHubConsumerClient.js.map +1 -1
- package/dist/browser/eventHubProducerClient.d.ts.map +1 -1
- package/dist/browser/eventHubProducerClient.js +3 -6
- package/dist/browser/eventHubProducerClient.js.map +1 -1
- package/dist/browser/eventHubSender.d.ts.map +1 -1
- package/dist/browser/eventHubSender.js +6 -4
- package/dist/browser/eventHubSender.js.map +1 -1
- package/dist/browser/partitionReceiver.js +4 -4
- package/dist/browser/partitionReceiver.js.map +1 -1
- package/dist/browser/util/timerLoop.d.ts.map +1 -1
- package/dist/browser/util/timerLoop.js +12 -5
- package/dist/browser/util/timerLoop.js.map +1 -1
- package/dist/commonjs/batchingPartitionChannel.d.ts.map +1 -1
- package/dist/commonjs/batchingPartitionChannel.js +2 -1
- package/dist/commonjs/batchingPartitionChannel.js.map +1 -1
- package/dist/commonjs/connectionContext.d.ts.map +1 -1
- package/dist/commonjs/connectionContext.js +10 -4
- package/dist/commonjs/connectionContext.js.map +1 -1
- package/dist/commonjs/eventHubBufferedProducerClient.d.ts.map +1 -1
- package/dist/commonjs/eventHubBufferedProducerClient.js +2 -1
- package/dist/commonjs/eventHubBufferedProducerClient.js.map +1 -1
- package/dist/commonjs/eventHubConsumerClient.d.ts.map +1 -1
- package/dist/commonjs/eventHubConsumerClient.js +3 -6
- package/dist/commonjs/eventHubConsumerClient.js.map +1 -1
- package/dist/commonjs/eventHubProducerClient.d.ts.map +1 -1
- package/dist/commonjs/eventHubProducerClient.js +3 -6
- package/dist/commonjs/eventHubProducerClient.js.map +1 -1
- package/dist/commonjs/eventHubSender.d.ts.map +1 -1
- package/dist/commonjs/eventHubSender.js +6 -4
- package/dist/commonjs/eventHubSender.js.map +1 -1
- package/dist/commonjs/partitionReceiver.js +4 -4
- package/dist/commonjs/partitionReceiver.js.map +1 -1
- package/dist/commonjs/util/timerLoop.d.ts.map +1 -1
- package/dist/commonjs/util/timerLoop.js +12 -5
- package/dist/commonjs/util/timerLoop.js.map +1 -1
- package/dist/esm/batchingPartitionChannel.d.ts.map +1 -1
- package/dist/esm/batchingPartitionChannel.js +2 -1
- package/dist/esm/batchingPartitionChannel.js.map +1 -1
- package/dist/esm/connectionContext.d.ts.map +1 -1
- package/dist/esm/connectionContext.js +10 -4
- package/dist/esm/connectionContext.js.map +1 -1
- package/dist/esm/eventHubBufferedProducerClient.d.ts.map +1 -1
- package/dist/esm/eventHubBufferedProducerClient.js +2 -1
- package/dist/esm/eventHubBufferedProducerClient.js.map +1 -1
- package/dist/esm/eventHubConsumerClient.d.ts.map +1 -1
- package/dist/esm/eventHubConsumerClient.js +3 -6
- package/dist/esm/eventHubConsumerClient.js.map +1 -1
- package/dist/esm/eventHubProducerClient.d.ts.map +1 -1
- package/dist/esm/eventHubProducerClient.js +3 -6
- package/dist/esm/eventHubProducerClient.js.map +1 -1
- package/dist/esm/eventHubSender.d.ts.map +1 -1
- package/dist/esm/eventHubSender.js +6 -4
- package/dist/esm/eventHubSender.js.map +1 -1
- package/dist/esm/partitionReceiver.js +4 -4
- package/dist/esm/partitionReceiver.js.map +1 -1
- package/dist/esm/util/timerLoop.d.ts.map +1 -1
- package/dist/esm/util/timerLoop.js +12 -5
- package/dist/esm/util/timerLoop.js.map +1 -1
- package/dist/react-native/batchingPartitionChannel.d.ts +94 -0
- package/dist/react-native/batchingPartitionChannel.d.ts.map +1 -0
- package/dist/react-native/batchingPartitionChannel.js +255 -0
- package/dist/react-native/batchingPartitionChannel.js.map +1 -0
- package/dist/react-native/connectionContext.d.ts +108 -0
- package/dist/react-native/connectionContext.d.ts.map +1 -0
- package/dist/react-native/connectionContext.js +310 -0
- package/dist/react-native/connectionContext.js.map +1 -0
- package/dist/react-native/dataTransformer.d.ts +53 -0
- package/dist/react-native/dataTransformer.d.ts.map +1 -0
- package/dist/react-native/dataTransformer.js +133 -0
- package/dist/react-native/dataTransformer.js.map +1 -0
- package/dist/react-native/diagnostics/instrumentEventData.d.ts +28 -0
- package/dist/react-native/diagnostics/instrumentEventData.d.ts.map +1 -0
- package/dist/react-native/diagnostics/instrumentEventData.js +67 -0
- package/dist/react-native/diagnostics/instrumentEventData.js.map +1 -0
- package/dist/react-native/diagnostics/tracing.d.ts +19 -0
- package/dist/react-native/diagnostics/tracing.d.ts.map +1 -0
- package/dist/react-native/diagnostics/tracing.js +40 -0
- package/dist/react-native/diagnostics/tracing.js.map +1 -0
- package/dist/react-native/eventData.d.ts +295 -0
- package/dist/react-native/eventData.d.ts.map +1 -0
- package/dist/react-native/eventData.js +247 -0
- package/dist/react-native/eventData.js.map +1 -0
- package/dist/react-native/eventDataAdapter.d.ts +69 -0
- package/dist/react-native/eventDataAdapter.d.ts.map +1 -0
- package/dist/react-native/eventDataAdapter.js +38 -0
- package/dist/react-native/eventDataAdapter.js.map +1 -0
- package/dist/react-native/eventDataBatch.d.ts +225 -0
- package/dist/react-native/eventDataBatch.d.ts.map +1 -0
- package/dist/react-native/eventDataBatch.js +301 -0
- package/dist/react-native/eventDataBatch.js.map +1 -0
- package/dist/react-native/eventHubBufferedProducerClient.d.ts +323 -0
- package/dist/react-native/eventHubBufferedProducerClient.d.ts.map +1 -0
- package/dist/react-native/eventHubBufferedProducerClient.js +301 -0
- package/dist/react-native/eventHubBufferedProducerClient.js.map +1 -0
- package/dist/react-native/eventHubConsumerClient.d.ts +293 -0
- package/dist/react-native/eventHubConsumerClient.d.ts.map +1 -0
- package/dist/react-native/eventHubConsumerClient.js +336 -0
- package/dist/react-native/eventHubConsumerClient.js.map +1 -0
- package/dist/react-native/eventHubConsumerClientModels.d.ts +218 -0
- package/dist/react-native/eventHubConsumerClientModels.d.ts.map +1 -0
- package/dist/react-native/eventHubConsumerClientModels.js +4 -0
- package/dist/react-native/eventHubConsumerClientModels.js.map +1 -0
- package/dist/react-native/eventHubProducerClient.d.ts +299 -0
- package/dist/react-native/eventHubProducerClient.d.ts.map +1 -0
- package/dist/react-native/eventHubProducerClient.js +366 -0
- package/dist/react-native/eventHubProducerClient.js.map +1 -0
- package/dist/react-native/eventHubSender.d.ts +227 -0
- package/dist/react-native/eventHubSender.d.ts.map +1 -0
- package/dist/react-native/eventHubSender.js +626 -0
- package/dist/react-native/eventHubSender.js.map +1 -0
- package/dist/react-native/eventPosition.d.ts +73 -0
- package/dist/react-native/eventPosition.d.ts.map +1 -0
- package/dist/react-native/eventPosition.js +121 -0
- package/dist/react-native/eventPosition.js.map +1 -0
- package/dist/react-native/eventProcessor.d.ts +232 -0
- package/dist/react-native/eventProcessor.d.ts.map +1 -0
- package/dist/react-native/eventProcessor.js +389 -0
- package/dist/react-native/eventProcessor.js.map +1 -0
- package/dist/react-native/eventhubConnectionConfig.d.ts +96 -0
- package/dist/react-native/eventhubConnectionConfig.d.ts.map +1 -0
- package/dist/react-native/eventhubConnectionConfig.js +98 -0
- package/dist/react-native/eventhubConnectionConfig.js.map +1 -0
- package/dist/react-native/impl/awaitableQueue.d.ts +25 -0
- package/dist/react-native/impl/awaitableQueue.d.ts.map +1 -0
- package/dist/react-native/impl/awaitableQueue.js +51 -0
- package/dist/react-native/impl/awaitableQueue.js.map +1 -0
- package/dist/react-native/impl/partitionAssigner.d.ts +29 -0
- package/dist/react-native/impl/partitionAssigner.d.ts.map +1 -0
- package/dist/react-native/impl/partitionAssigner.js +52 -0
- package/dist/react-native/impl/partitionAssigner.js.map +1 -0
- package/dist/react-native/impl/partitionGate.d.ts +27 -0
- package/dist/react-native/impl/partitionGate.d.ts.map +1 -0
- package/dist/react-native/impl/partitionGate.js +38 -0
- package/dist/react-native/impl/partitionGate.js.map +1 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.d.ts +6 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.d.ts.map +1 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.js +111 -0
- package/dist/react-native/impl/partitionKeyToIdMapper.js.map +1 -0
- package/dist/react-native/inMemoryCheckpointStore.d.ts +44 -0
- package/dist/react-native/inMemoryCheckpointStore.d.ts.map +1 -0
- package/dist/react-native/inMemoryCheckpointStore.js +94 -0
- package/dist/react-native/inMemoryCheckpointStore.js.map +1 -0
- package/dist/react-native/index.d.ts +21 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +12 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.js +40 -0
- package/dist/react-native/loadBalancerStrategies/balancedStrategy.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.js +29 -0
- package/dist/react-native/loadBalancerStrategies/greedyStrategy.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.js +245 -0
- package/dist/react-native/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.js +22 -0
- package/dist/react-native/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
- package/dist/react-native/logger.d.ts +37 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +56 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/managementClient.d.ts +145 -0
- package/dist/react-native/managementClient.d.ts.map +1 -0
- package/dist/react-native/managementClient.js +305 -0
- package/dist/react-native/managementClient.js.map +1 -0
- package/dist/react-native/models/private.d.ts +185 -0
- package/dist/react-native/models/private.d.ts.map +1 -0
- package/dist/react-native/models/private.js +4 -0
- package/dist/react-native/models/private.js.map +1 -0
- package/dist/react-native/models/public.d.ts +240 -0
- package/dist/react-native/models/public.d.ts.map +1 -0
- package/dist/react-native/models/public.js +18 -0
- package/dist/react-native/models/public.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/partitionProcessor.d.ts +134 -0
- package/dist/react-native/partitionProcessor.d.ts.map +1 -0
- package/dist/react-native/partitionProcessor.js +137 -0
- package/dist/react-native/partitionProcessor.js.map +1 -0
- package/dist/react-native/partitionPump.d.ts +38 -0
- package/dist/react-native/partitionPump.d.ts.map +1 -0
- package/dist/react-native/partitionPump.js +175 -0
- package/dist/react-native/partitionPump.js.map +1 -0
- package/dist/react-native/partitionReceiver.d.ts +82 -0
- package/dist/react-native/partitionReceiver.d.ts.map +1 -0
- package/dist/react-native/partitionReceiver.js +335 -0
- package/dist/react-native/partitionReceiver.js.map +1 -0
- package/dist/react-native/pumpManager.d.ts +72 -0
- package/dist/react-native/pumpManager.d.ts.map +1 -0
- package/dist/react-native/pumpManager.js +120 -0
- package/dist/react-native/pumpManager.js.map +1 -0
- package/dist/react-native/util/connectionStringUtils.d.ts +52 -0
- package/dist/react-native/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/react-native/util/connectionStringUtils.js +48 -0
- package/dist/react-native/util/connectionStringUtils.js.map +1 -0
- package/dist/react-native/util/constants.d.ts +25 -0
- package/dist/react-native/util/constants.d.ts.map +1 -0
- package/dist/react-native/util/constants.js +27 -0
- package/dist/react-native/util/constants.js.map +1 -0
- package/dist/react-native/util/delayWithoutThrow.d.ts +8 -0
- package/dist/react-native/util/delayWithoutThrow.d.ts.map +1 -0
- package/dist/react-native/util/delayWithoutThrow.js +17 -0
- package/dist/react-native/util/delayWithoutThrow.js.map +1 -0
- package/dist/react-native/util/error.d.ts +39 -0
- package/dist/react-native/util/error.d.ts.map +1 -0
- package/dist/react-native/util/error.js +103 -0
- package/dist/react-native/util/error.js.map +1 -0
- package/dist/react-native/util/getPromiseParts.d.ts +10 -0
- package/dist/react-native/util/getPromiseParts.d.ts.map +1 -0
- package/dist/react-native/util/getPromiseParts.js +20 -0
- package/dist/react-native/util/getPromiseParts.js.map +1 -0
- package/dist/react-native/util/operationOptions.d.ts +16 -0
- package/dist/react-native/util/operationOptions.d.ts.map +1 -0
- package/dist/react-native/util/operationOptions.js +4 -0
- package/dist/react-native/util/operationOptions.js.map +1 -0
- package/dist/react-native/util/parseEndpoint.d.ts +11 -0
- package/dist/react-native/util/parseEndpoint.d.ts.map +1 -0
- package/dist/react-native/util/parseEndpoint.js +17 -0
- package/dist/react-native/util/parseEndpoint.js.map +1 -0
- package/dist/react-native/util/retries.d.ts +6 -0
- package/dist/react-native/util/retries.d.ts.map +1 -0
- package/dist/react-native/util/retries.js +13 -0
- package/dist/react-native/util/retries.js.map +1 -0
- package/dist/react-native/util/runtimeInfo-react-native.d.mts.map +1 -0
- package/dist/react-native/util/runtimeInfo-react-native.mjs.map +1 -0
- package/dist/react-native/util/runtimeInfo.d.ts +6 -0
- package/dist/react-native/util/runtimeInfo.js +20 -0
- package/dist/react-native/util/timerLoop.d.ts +26 -0
- package/dist/react-native/util/timerLoop.d.ts.map +1 -0
- package/dist/react-native/util/timerLoop.js +34 -0
- package/dist/react-native/util/timerLoop.js.map +1 -0
- package/dist/react-native/util/typeGuards.d.ts +8 -0
- package/dist/react-native/util/typeGuards.d.ts.map +1 -0
- package/dist/react-native/util/typeGuards.js +12 -0
- package/dist/react-native/util/typeGuards.js.map +1 -0
- package/dist/react-native/util/utils.d.ts +7 -0
- package/dist/react-native/util/utils.d.ts.map +1 -0
- package/dist/react-native/util/utils.js +13 -0
- package/dist/react-native/util/utils.js.map +1 -0
- package/dist/react-native/withAuth.d.ts +25 -0
- package/dist/react-native/withAuth.d.ts.map +1 -0
- package/dist/react-native/withAuth.js +84 -0
- package/dist/react-native/withAuth.js.map +1 -0
- package/package.json +16 -11
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { isAmqpAnnotatedMessage } from "../eventData.js";
|
|
4
|
+
import { toSpanOptions, tracingClient } from "./tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const TRACEPARENT_PROPERTY = "Diagnostic-Id";
|
|
9
|
+
/**
|
|
10
|
+
* Populates the `EventData` with `SpanContext` info to support trace propagation.
|
|
11
|
+
* Creates and returns a copy of the passed in `EventData` unless the `EventData`
|
|
12
|
+
* has already been instrumented.
|
|
13
|
+
* @param eventData - The `EventData` or `AmqpAnnotatedMessage` to instrument.
|
|
14
|
+
* @param span - The `Span` containing the context to propagate tracing information.
|
|
15
|
+
* @param operation - The type of the operation being performed.
|
|
16
|
+
*/
|
|
17
|
+
export function instrumentEventData(eventData, options, entityPath, host, operation) {
|
|
18
|
+
const props = isAmqpAnnotatedMessage(eventData)
|
|
19
|
+
? eventData.applicationProperties
|
|
20
|
+
: eventData.properties;
|
|
21
|
+
// check if the event has already been instrumented
|
|
22
|
+
const previouslyInstrumented = Boolean(props?.[TRACEPARENT_PROPERTY]);
|
|
23
|
+
if (previouslyInstrumented) {
|
|
24
|
+
return { event: eventData, spanContext: undefined };
|
|
25
|
+
}
|
|
26
|
+
const { span: messageSpan, updatedOptions } = tracingClient.startSpan("message", options, toSpanOptions({ entityPath, host }, operation, "producer"));
|
|
27
|
+
try {
|
|
28
|
+
if (!messageSpan.isRecording()) {
|
|
29
|
+
return {
|
|
30
|
+
event: eventData,
|
|
31
|
+
spanContext: undefined,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const traceParent = tracingClient.createRequestHeaders(updatedOptions.tracingOptions?.tracingContext)["traceparent"];
|
|
35
|
+
if (traceParent) {
|
|
36
|
+
const copiedProps = { ...props };
|
|
37
|
+
// create a copy so the original isn't modified
|
|
38
|
+
if (isAmqpAnnotatedMessage(eventData)) {
|
|
39
|
+
eventData = { ...eventData, applicationProperties: copiedProps };
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
eventData = { ...eventData, properties: copiedProps };
|
|
43
|
+
}
|
|
44
|
+
copiedProps[TRACEPARENT_PROPERTY] = traceParent;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
event: eventData,
|
|
48
|
+
spanContext: updatedOptions.tracingOptions?.tracingContext,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
messageSpan.end();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Extracts the `SpanContext` from an `EventData` if the context exists.
|
|
57
|
+
* @param eventData - An individual `EventData` object.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export function extractSpanContextFromEventData(eventData) {
|
|
61
|
+
if (!eventData.properties || !eventData.properties[TRACEPARENT_PROPERTY]) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const diagnosticId = eventData.properties[TRACEPARENT_PROPERTY];
|
|
65
|
+
return tracingClient.parseTraceparentHeader(diagnosticId);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=instrumentEventData.js.map
|
|
@@ -0,0 +1 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,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;YAEjC,+CAA+C;YAC/C,IAAI,sBAAsB,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,SAAS,GAAG,EAAE,GAAG,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACN,SAAS,GAAG,EAAE,GAAG,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;YACxD,CAAC;YACD,WAAW,CAAC,oBAAoB,CAAC,GAAG,WAAW,CAAC;QAClD,CAAC;QAED,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,cAAc,CAAC,cAAc,EAAE,cAAc;SAC3D,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,WAAW,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,SAAoB;IAClE,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACzE,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAChE,OAAO,aAAa,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { EventData } from \"../eventData.js\";\nimport { isAmqpAnnotatedMessage } from \"../eventData.js\";\nimport type { TracingContext } from \"@azure/core-tracing\";\nimport type { AmqpAnnotatedMessage } from \"@azure/core-amqp\";\nimport type { OperationOptions } from \"../util/operationOptions.js\";\nimport type { MessagingOperationNames } from \"./tracing.js\";\nimport { toSpanOptions, tracingClient } from \"./tracing.js\";\n\n/**\n * @internal\n */\nexport const TRACEPARENT_PROPERTY = \"Diagnostic-Id\";\n\n/**\n * Populates the `EventData` with `SpanContext` info to support trace propagation.\n * Creates and returns a copy of the passed in `EventData` unless the `EventData`\n * has already been instrumented.\n * @param eventData - The `EventData` or `AmqpAnnotatedMessage` to instrument.\n * @param span - The `Span` containing the context to propagate tracing information.\n * @param operation - The type of the operation being performed.\n */\nexport function instrumentEventData(\n eventData: EventData | AmqpAnnotatedMessage,\n options: OperationOptions,\n entityPath: string,\n host: string,\n operation?: MessagingOperationNames,\n): { event: EventData; spanContext: TracingContext | undefined } {\n const props = isAmqpAnnotatedMessage(eventData)\n ? eventData.applicationProperties\n : eventData.properties;\n\n // check if the event has already been instrumented\n const previouslyInstrumented = Boolean(props?.[TRACEPARENT_PROPERTY]);\n\n if (previouslyInstrumented) {\n return { event: eventData, spanContext: undefined };\n }\n\n const { span: messageSpan, updatedOptions } = tracingClient.startSpan(\n \"message\",\n options,\n toSpanOptions({ entityPath, host }, operation, \"producer\"),\n );\n try {\n if (!messageSpan.isRecording()) {\n return {\n event: eventData,\n spanContext: undefined,\n };\n }\n\n const traceParent = tracingClient.createRequestHeaders(\n updatedOptions.tracingOptions?.tracingContext,\n )[\"traceparent\"];\n if (traceParent) {\n const copiedProps = { ...props };\n\n // create a copy so the original isn't modified\n if (isAmqpAnnotatedMessage(eventData)) {\n eventData = { ...eventData, applicationProperties: copiedProps };\n } else {\n eventData = { ...eventData, properties: copiedProps };\n }\n copiedProps[TRACEPARENT_PROPERTY] = traceParent;\n }\n\n return {\n event: eventData,\n spanContext: updatedOptions.tracingOptions?.tracingContext,\n };\n } finally {\n messageSpan.end();\n }\n}\n\n/**\n * Extracts the `SpanContext` from an `EventData` if the context exists.\n * @param eventData - An individual `EventData` object.\n * @internal\n */\nexport function extractSpanContextFromEventData(eventData: EventData): TracingContext | undefined {\n if (!eventData.properties || !eventData.properties[TRACEPARENT_PROPERTY]) {\n return;\n }\n\n const diagnosticId = eventData.properties[TRACEPARENT_PROPERTY];\n return tracingClient.parseTraceparentHeader(diagnosticId);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TracingSpanOptions, TracingSpanKind } from "@azure/core-tracing";
|
|
2
|
+
import type { EventHubConnectionConfig } from "../eventhubConnectionConfig.js";
|
|
3
|
+
/**
|
|
4
|
+
* The names of the operations that can be instrumented.
|
|
5
|
+
*/
|
|
6
|
+
export type MessagingOperationNames = "publish" | "receive" | "process";
|
|
7
|
+
/**
|
|
8
|
+
* The {@link TracingClient} that is used to add tracing spans.
|
|
9
|
+
*/
|
|
10
|
+
export declare const tracingClient: import("@azure/core-tracing").TracingClient;
|
|
11
|
+
/**
|
|
12
|
+
* Creates {@link TracingSpanOptions} from the provided data.
|
|
13
|
+
* @param eventHubConfig - The configuration object containing initial attributes to set on the span.
|
|
14
|
+
* @param spanKind - The {@link TracingSpanKind} for the newly created span.
|
|
15
|
+
* @param operation - The operation type.
|
|
16
|
+
* @returns a {@link TracingSpanOptions} that can be passed to a {@link TracingClient}
|
|
17
|
+
*/
|
|
18
|
+
export declare function toSpanOptions(eventHubConfig: Pick<EventHubConnectionConfig, "entityPath" | "host">, operation?: MessagingOperationNames, spanKind?: TracingSpanKind): TracingSpanOptions;
|
|
19
|
+
//# sourceMappingURL=tracing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/tracing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG/E;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,aAAa,6CAIxB,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,cAAc,EAAE,IAAI,CAAC,wBAAwB,EAAE,YAAY,GAAG,MAAM,CAAC,EACrE,SAAS,CAAC,EAAE,uBAAuB,EACnC,QAAQ,CAAC,EAAE,eAAe,GACzB,kBAAkB,CAuBpB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createTracingClient } from "@azure/core-tracing";
|
|
4
|
+
import { packageJsonInfo } from "../util/constants.js";
|
|
5
|
+
/**
|
|
6
|
+
* The {@link TracingClient} that is used to add tracing spans.
|
|
7
|
+
*/
|
|
8
|
+
export const tracingClient = createTracingClient({
|
|
9
|
+
namespace: "Microsoft.EventHub",
|
|
10
|
+
packageName: packageJsonInfo.name,
|
|
11
|
+
packageVersion: packageJsonInfo.version,
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Creates {@link TracingSpanOptions} from the provided data.
|
|
15
|
+
* @param eventHubConfig - The configuration object containing initial attributes to set on the span.
|
|
16
|
+
* @param spanKind - The {@link TracingSpanKind} for the newly created span.
|
|
17
|
+
* @param operation - The operation type.
|
|
18
|
+
* @returns a {@link TracingSpanOptions} that can be passed to a {@link TracingClient}
|
|
19
|
+
*/
|
|
20
|
+
export function toSpanOptions(eventHubConfig, operation, spanKind) {
|
|
21
|
+
const propertyName = operation === "process" || operation === "receive"
|
|
22
|
+
? "messaging.source.name"
|
|
23
|
+
: "messaging.destination.name";
|
|
24
|
+
const spanAttributes = {
|
|
25
|
+
"messaging.system": "eventhubs",
|
|
26
|
+
[propertyName]: eventHubConfig.entityPath,
|
|
27
|
+
"net.peer.name": eventHubConfig.host,
|
|
28
|
+
};
|
|
29
|
+
if (operation) {
|
|
30
|
+
spanAttributes["messaging.operation"] = operation;
|
|
31
|
+
}
|
|
32
|
+
const spanOptions = {
|
|
33
|
+
spanAttributes: spanAttributes,
|
|
34
|
+
};
|
|
35
|
+
if (spanKind) {
|
|
36
|
+
spanOptions.spanKind = spanKind;
|
|
37
|
+
}
|
|
38
|
+
return spanOptions;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=tracing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/diagnostics/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOvD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;IAC/C,SAAS,EAAE,oBAAoB;IAC/B,WAAW,EAAE,eAAe,CAAC,IAAI;IACjC,cAAc,EAAE,eAAe,CAAC,OAAO;CACxC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,cAAqE,EACrE,SAAmC,EACnC,QAA0B;IAE1B,MAAM,YAAY,GAChB,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;QAChD,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,4BAA4B,CAAC;IAEnC,MAAM,cAAc,GAAG;QACrB,kBAAkB,EAAE,WAAW;QAC/B,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC,UAAU;QACzC,eAAe,EAAE,cAAc,CAAC,IAAI;KACrC,CAAC;IAEF,IAAI,SAAS,EAAE,CAAC;QACd,cAAc,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IACpD,CAAC;IAED,MAAM,WAAW,GAAuB;QACtC,cAAc,EAAE,cAAc;KAC/B,CAAC;IACF,IAAI,QAAQ,EAAE,CAAC;QACb,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAClC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TracingSpanOptions, TracingSpanKind } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport type { EventHubConnectionConfig } from \"../eventhubConnectionConfig.js\";\nimport { packageJsonInfo } from \"../util/constants.js\";\n\n/**\n * The names of the operations that can be instrumented.\n */\nexport type MessagingOperationNames = \"publish\" | \"receive\" | \"process\";\n\n/**\n * The {@link TracingClient} that is used to add tracing spans.\n */\nexport const tracingClient = createTracingClient({\n namespace: \"Microsoft.EventHub\",\n packageName: packageJsonInfo.name,\n packageVersion: packageJsonInfo.version,\n});\n\n/**\n * Creates {@link TracingSpanOptions} from the provided data.\n * @param eventHubConfig - The configuration object containing initial attributes to set on the span.\n * @param spanKind - The {@link TracingSpanKind} for the newly created span.\n * @param operation - The operation type.\n * @returns a {@link TracingSpanOptions} that can be passed to a {@link TracingClient}\n */\nexport function toSpanOptions(\n eventHubConfig: Pick<EventHubConnectionConfig, \"entityPath\" | \"host\">,\n operation?: MessagingOperationNames,\n spanKind?: TracingSpanKind,\n): TracingSpanOptions {\n const propertyName =\n operation === \"process\" || operation === \"receive\"\n ? \"messaging.source.name\"\n : \"messaging.destination.name\";\n\n const spanAttributes = {\n \"messaging.system\": \"eventhubs\",\n [propertyName]: eventHubConfig.entityPath,\n \"net.peer.name\": eventHubConfig.host,\n };\n\n if (operation) {\n spanAttributes[\"messaging.operation\"] = operation;\n }\n\n const spanOptions: TracingSpanOptions = {\n spanAttributes: spanAttributes,\n };\n if (spanKind) {\n spanOptions.spanKind = spanKind;\n }\n return spanOptions;\n}\n"]}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { AmqpAnnotatedMessage } from "@azure/core-amqp";
|
|
2
|
+
import type { DeliveryAnnotations, MessageAnnotations, Message as RheaMessage } from "rhea-promise";
|
|
3
|
+
import type { PENDING_PUBLISH_SEQ_NUM_SYMBOL } from "./util/constants.js";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the delivery annotations.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface EventHubDeliveryAnnotations extends DeliveryAnnotations {
|
|
9
|
+
/**
|
|
10
|
+
* The offset of the last event.
|
|
11
|
+
*/
|
|
12
|
+
last_enqueued_offset?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The sequence number of the last event.
|
|
15
|
+
*/
|
|
16
|
+
last_enqueued_sequence_number?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The enqueued time of the last event.
|
|
19
|
+
*/
|
|
20
|
+
last_enqueued_time_utc?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The retrieval time of the last event.
|
|
23
|
+
*/
|
|
24
|
+
runtime_info_retrieval_time_utc?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Any unknown delivery annotations.
|
|
27
|
+
*/
|
|
28
|
+
[x: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Map containing message attributes that will be held in the message header.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export interface EventHubMessageAnnotations extends MessageAnnotations {
|
|
35
|
+
/**
|
|
36
|
+
* Annotation for the partition key set for the event.
|
|
37
|
+
*/
|
|
38
|
+
"x-opt-partition-key"?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Annotation for the sequence number of the event.
|
|
41
|
+
*/
|
|
42
|
+
"x-opt-sequence-number"?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Annotation for the enqueued time of the event.
|
|
45
|
+
*/
|
|
46
|
+
"x-opt-enqueued-time"?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Annotation for the offset of the event.
|
|
49
|
+
*/
|
|
50
|
+
"x-opt-offset"?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Any other annotation that can be added to the message.
|
|
53
|
+
*/
|
|
54
|
+
[x: string]: any;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Describes the structure of an event to be sent or received from the EventHub.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export interface EventDataInternal {
|
|
61
|
+
/**
|
|
62
|
+
* The message body that needs to be sent or is received.
|
|
63
|
+
*/
|
|
64
|
+
body: any;
|
|
65
|
+
/**
|
|
66
|
+
* The enqueued time of the event.
|
|
67
|
+
*/
|
|
68
|
+
enqueuedTimeUtc?: Date;
|
|
69
|
+
/**
|
|
70
|
+
* If specified EventHub will hash this to a partitionId.
|
|
71
|
+
* It guarantees that messages end up in a specific partition on the event hub.
|
|
72
|
+
*/
|
|
73
|
+
partitionKey?: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* The offset of the event.
|
|
76
|
+
*/
|
|
77
|
+
offset?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The sequence number of the event.
|
|
80
|
+
*/
|
|
81
|
+
sequenceNumber?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The application specific properties.
|
|
84
|
+
*/
|
|
85
|
+
properties?: {
|
|
86
|
+
[property: string]: any;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The last sequence number of the event within the partition stream of the Event Hub.
|
|
90
|
+
*/
|
|
91
|
+
lastSequenceNumber?: number;
|
|
92
|
+
/**
|
|
93
|
+
* The offset of the last enqueued event.
|
|
94
|
+
*/
|
|
95
|
+
lastEnqueuedOffset?: string;
|
|
96
|
+
/**
|
|
97
|
+
* The enqueued UTC time of the last event.
|
|
98
|
+
*/
|
|
99
|
+
lastEnqueuedTime?: Date;
|
|
100
|
+
/**
|
|
101
|
+
* The time when the runtime info was retrieved
|
|
102
|
+
*/
|
|
103
|
+
retrievalTime?: Date;
|
|
104
|
+
/**
|
|
105
|
+
* The properties set by the service.
|
|
106
|
+
*/
|
|
107
|
+
systemProperties?: {
|
|
108
|
+
[property: string]: any;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* The content type of the message. Optionally describes
|
|
112
|
+
* the payload of the message, with a descriptor following the format of RFC2045, Section 5, for
|
|
113
|
+
* example "application/json".
|
|
114
|
+
*/
|
|
115
|
+
contentType?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The correlation identifier that allows an
|
|
118
|
+
* application to specify a context for the message for the purposes of correlation, for example
|
|
119
|
+
* reflecting the MessageId of a message that is being replied to.
|
|
120
|
+
*/
|
|
121
|
+
correlationId?: string | number | Buffer;
|
|
122
|
+
/**
|
|
123
|
+
* The message identifier is an
|
|
124
|
+
* application-defined value that uniquely identifies the message and its payload.
|
|
125
|
+
*
|
|
126
|
+
* Note: Numbers that are not whole integers are not allowed.
|
|
127
|
+
*/
|
|
128
|
+
messageId?: string | number | Buffer;
|
|
129
|
+
/**
|
|
130
|
+
* Returns the underlying raw amqp message.
|
|
131
|
+
*/
|
|
132
|
+
getRawAmqpMessage(): AmqpAnnotatedMessage;
|
|
133
|
+
/**
|
|
134
|
+
* The pending publish sequence number, set while the event
|
|
135
|
+
* is being published with idempotent partitions enabled.
|
|
136
|
+
*/
|
|
137
|
+
[PENDING_PUBLISH_SEQ_NUM_SYMBOL]?: number;
|
|
138
|
+
/**
|
|
139
|
+
* The sequence number the event was published with
|
|
140
|
+
* when idempotent partitions are enabled.
|
|
141
|
+
*/
|
|
142
|
+
_publishedSequenceNumber?: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Converts the AMQP message to an EventData.
|
|
146
|
+
* @param msg - The AMQP message that needs to be converted to EventData.
|
|
147
|
+
* @param skipParsingBodyAsJson - Boolean to skip running JSON.parse() on message body when body type is `content`.
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
export declare function fromRheaMessage(msg: RheaMessage, skipParsingBodyAsJson: boolean): EventDataInternal;
|
|
151
|
+
/**
|
|
152
|
+
* Converts an EventData object to an AMQP message.
|
|
153
|
+
* @param data - The EventData object that needs to be converted to an AMQP message.
|
|
154
|
+
* @param partitionKey - An optional key to determine the partition that this event should land in.
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
export declare function toRheaMessage(data: EventData | AmqpAnnotatedMessage, partitionKey?: string): RheaMessage;
|
|
158
|
+
/**
|
|
159
|
+
* The interface that describes the data to be sent to Event Hub.
|
|
160
|
+
* Use this as a reference when creating the object to be sent when using the `EventHubProducerClient`.
|
|
161
|
+
* For example, `{ body: "your-data" }` or
|
|
162
|
+
* ```
|
|
163
|
+
* {
|
|
164
|
+
* body: "your-data",
|
|
165
|
+
* properties: {
|
|
166
|
+
* propertyName: "property value"
|
|
167
|
+
* }
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export interface EventData {
|
|
172
|
+
/**
|
|
173
|
+
* The message body that needs to be sent.
|
|
174
|
+
* If the application reading the events is not using this SDK,
|
|
175
|
+
* convert your body payload to a byte array or Buffer for better
|
|
176
|
+
* cross-language compatibility.
|
|
177
|
+
*/
|
|
178
|
+
body: any;
|
|
179
|
+
/**
|
|
180
|
+
* The content type of the message. Optionally describes
|
|
181
|
+
* the payload of the message, with a descriptor following the format of RFC2045, Section 5, for
|
|
182
|
+
* example "application/json".
|
|
183
|
+
*/
|
|
184
|
+
contentType?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The correlation identifier that allows an
|
|
187
|
+
* application to specify a context for the message for the purposes of correlation, for example
|
|
188
|
+
* reflecting the MessageId of a message that is being replied to.
|
|
189
|
+
*/
|
|
190
|
+
correlationId?: string | number | Buffer;
|
|
191
|
+
/**
|
|
192
|
+
* The message identifier is an
|
|
193
|
+
* application-defined value that uniquely identifies the message and its payload.
|
|
194
|
+
*
|
|
195
|
+
* Note: Numbers that are not whole integers are not allowed.
|
|
196
|
+
*/
|
|
197
|
+
messageId?: string | number | Buffer;
|
|
198
|
+
/**
|
|
199
|
+
* Set of key value pairs that can be used to set properties specific to user application.
|
|
200
|
+
*/
|
|
201
|
+
properties?: {
|
|
202
|
+
[key: string]: any;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Asserts that the provided data conforms to the `EventData` interface.
|
|
207
|
+
*
|
|
208
|
+
* This function performs runtime checks on the `data` object to ensure it matches the expected
|
|
209
|
+
* structure and types defined in the `EventData` interface. If any of the checks fail, it throws
|
|
210
|
+
* an error with a descriptive message indicating the mismatch.
|
|
211
|
+
*
|
|
212
|
+
* @param data - The data object to validate as `EventData`.
|
|
213
|
+
* @throws \{Error\} Throws an error if the data does not conform to the `EventData` interface.
|
|
214
|
+
*/
|
|
215
|
+
export declare function assertIsEventData(data: any): asserts data is EventData;
|
|
216
|
+
/**
|
|
217
|
+
* The interface that describes the structure of the event received from Event Hub.
|
|
218
|
+
* Use this as a reference when creating the `processEvents` function to process the events
|
|
219
|
+
* received from an Event Hub when using the `EventHubConsumerClient`.
|
|
220
|
+
*/
|
|
221
|
+
export interface ReceivedEventData {
|
|
222
|
+
/**
|
|
223
|
+
* The message body that needs to be sent or is received.
|
|
224
|
+
*/
|
|
225
|
+
body: any;
|
|
226
|
+
/**
|
|
227
|
+
* The application specific properties.
|
|
228
|
+
*/
|
|
229
|
+
properties?: {
|
|
230
|
+
[key: string]: any;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* The enqueued time of the event.
|
|
234
|
+
*/
|
|
235
|
+
enqueuedTimeUtc: Date;
|
|
236
|
+
/**
|
|
237
|
+
* When specified Event Hub will hash this to a partitionId.
|
|
238
|
+
* It guarantees that messages end up in a specific partition on the event hub.
|
|
239
|
+
*/
|
|
240
|
+
partitionKey: string | null;
|
|
241
|
+
/**
|
|
242
|
+
* The offset of the event.
|
|
243
|
+
*/
|
|
244
|
+
offset: string;
|
|
245
|
+
/**
|
|
246
|
+
* The sequence number of the event.
|
|
247
|
+
*/
|
|
248
|
+
sequenceNumber: number;
|
|
249
|
+
/**
|
|
250
|
+
* The properties set by the service.
|
|
251
|
+
*/
|
|
252
|
+
systemProperties?: {
|
|
253
|
+
[key: string]: any;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* The content type of the message. Optionally describes
|
|
257
|
+
* the payload of the message, with a descriptor following the format of RFC2045, Section 5, for
|
|
258
|
+
* example "application/json".
|
|
259
|
+
*/
|
|
260
|
+
contentType?: string;
|
|
261
|
+
/**
|
|
262
|
+
* The correlation identifier that allows an
|
|
263
|
+
* application to specify a context for the message for the purposes of correlation, for example
|
|
264
|
+
* reflecting the MessageId of a message that is being replied to.
|
|
265
|
+
*/
|
|
266
|
+
correlationId?: string | number | Buffer;
|
|
267
|
+
/**
|
|
268
|
+
* The message identifier is an
|
|
269
|
+
* application-defined value that uniquely identifies the message and its payload.
|
|
270
|
+
*/
|
|
271
|
+
messageId?: string | number | Buffer;
|
|
272
|
+
/**
|
|
273
|
+
* Returns the underlying raw amqp message.
|
|
274
|
+
*/
|
|
275
|
+
getRawAmqpMessage(): AmqpAnnotatedMessage;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @internal
|
|
279
|
+
*/
|
|
280
|
+
export declare function isAmqpAnnotatedMessage(possible: unknown): possible is AmqpAnnotatedMessage;
|
|
281
|
+
/**
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
export interface PopulateIdempotentMessageAnnotationsParameters {
|
|
285
|
+
isIdempotentPublishingEnabled: boolean;
|
|
286
|
+
ownerLevel?: number;
|
|
287
|
+
producerGroupId?: number;
|
|
288
|
+
publishSequenceNumber?: number;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Populates a rhea message with idempotent producer properties.
|
|
292
|
+
* @internal
|
|
293
|
+
*/
|
|
294
|
+
export declare function populateIdempotentMessageAnnotations(rheaMessage: RheaMessage, { isIdempotentPublishingEnabled, ownerLevel, producerGroupId, publishSequenceNumber, }: PopulateIdempotentMessageAnnotationsParameters): void;
|
|
295
|
+
//# sourceMappingURL=eventData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventData.d.ts","sourceRoot":"","sources":["../../src/eventData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAa,MAAM,kBAAkB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC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