@azure/eventhubs-checkpointstore-blob 1.1.0-alpha.20250107.2 → 1.1.0-alpha.20250109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
An Azure Blob storage based solution to store checkpoints and to aid in load balancing when using `EventHubConsumerClient` from the [@azure/event-hubs](https://www.npmjs.com/package/@azure/event-hubs) library
|
|
4
4
|
|
|
5
5
|
Key links:
|
|
6
|
+
|
|
6
7
|
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventhub/eventhubs-checkpointstore-blob)
|
|
7
8
|
- [Package (npm)](https://www.npmjs.com/package/@azure/eventhubs-checkpointstore-blob)
|
|
8
|
-
- [API Reference Documentation](https://
|
|
9
|
+
- [API Reference Documentation](https://learn.microsoft.com/javascript/api/@azure/eventhubs-checkpointstore-blob/)
|
|
9
10
|
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventhub/eventhubs-checkpointstore-blob/samples)
|
|
10
11
|
|
|
11
12
|
## Getting started
|
|
@@ -20,8 +21,8 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP
|
|
|
20
21
|
### Prerequisites
|
|
21
22
|
|
|
22
23
|
- An [Azure subscription](https://azure.microsoft.com/free/)
|
|
23
|
-
- An [Event Hubs Namespace](https://
|
|
24
|
-
- A [Storage account](https://
|
|
24
|
+
- An [Event Hubs Namespace](https://learn.microsoft.com/azure/event-hubs/)
|
|
25
|
+
- A [Storage account](https://learn.microsoft.com/azure/storage/blobs/storage-blobs-introduction)
|
|
25
26
|
|
|
26
27
|
### Install the package
|
|
27
28
|
|
|
@@ -57,7 +58,7 @@ You also need to enable `compilerOptions.allowSyntheticDefaultImports` in your t
|
|
|
57
58
|
and to provide resiliency if a failover between readers running on different machines occurs. It is possible to return to older data by specifying a lower offset from this checkpointing process.
|
|
58
59
|
Through this mechanism, checkpointing enables both failover resiliency and event stream replay.
|
|
59
60
|
|
|
60
|
-
A [BlobCheckpointStore](https://
|
|
61
|
+
A [BlobCheckpointStore](https://learn.microsoft.com/javascript/api/@azure/eventhubs-checkpointstore-blob/blobcheckpointstore)
|
|
61
62
|
is a class that implements key methods required by the EventHubConsumerClient to balance load and update checkpoints.
|
|
62
63
|
|
|
63
64
|
## Examples
|
|
@@ -79,16 +80,16 @@ if (!containerClient.exists()) {
|
|
|
79
80
|
await containerClient.create(); // This can be skipped if the container already exists
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
const checkpointStore =
|
|
83
|
+
const checkpointStore = new BlobCheckpointStore(containerClient);
|
|
83
84
|
```
|
|
84
85
|
|
|
85
86
|
### Checkpoint events using Azure Blob storage
|
|
86
87
|
|
|
87
88
|
To checkpoint events received using Azure Blob Storage, you will need to pass an object
|
|
88
|
-
that is compatible with the [SubscriptionEventHandlers](https://
|
|
89
|
+
that is compatible with the [SubscriptionEventHandlers](https://learn.microsoft.com/javascript/api/@azure/event-hubs/subscriptioneventhandlers)
|
|
89
90
|
interface along with code to call the `updateCheckpoint()` method.
|
|
90
91
|
|
|
91
|
-
In this example, `SubscriptionHandlers` implements [SubscriptionEventHandlers](https://
|
|
92
|
+
In this example, `SubscriptionHandlers` implements [SubscriptionEventHandlers](https://learn.microsoft.com/javascript/api/@azure/event-hubs/subscriptioneventhandlers) and also handles checkpointing.
|
|
92
93
|
|
|
93
94
|
```javascript
|
|
94
95
|
const { EventHubConsumerClient } = require("@azure/event-hubs");
|
|
@@ -113,7 +114,7 @@ async function main() {
|
|
|
113
114
|
consumerGroup,
|
|
114
115
|
eventHubConnectionString,
|
|
115
116
|
eventHubName,
|
|
116
|
-
checkpointStore
|
|
117
|
+
checkpointStore,
|
|
117
118
|
);
|
|
118
119
|
|
|
119
120
|
const subscription = consumerClient.subscribe({
|
|
@@ -136,7 +137,7 @@ async function main() {
|
|
|
136
137
|
// handle any errors that occur during the course of
|
|
137
138
|
// this subscription
|
|
138
139
|
console.log(`Errors in subscription to partition ${context.partitionId}: ${err}`);
|
|
139
|
-
}
|
|
140
|
+
},
|
|
140
141
|
});
|
|
141
142
|
|
|
142
143
|
// Wait for a few seconds to receive events before closing
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/eventhubs-checkpointstore-blob",
|
|
3
3
|
"sdk-type": "client",
|
|
4
|
-
"version": "1.1.0-alpha.
|
|
4
|
+
"version": "1.1.0-alpha.20250109.1",
|
|
5
5
|
"description": "An Azure Storage Blob solution to store checkpoints when using Event Hubs.",
|
|
6
6
|
"author": "Microsoft Corporation",
|
|
7
7
|
"license": "MIT",
|
|
@@ -113,8 +113,8 @@
|
|
|
113
113
|
"azure-event-hubs"
|
|
114
114
|
],
|
|
115
115
|
"requiredResources": {
|
|
116
|
-
"Azure Event Hub": "https://
|
|
117
|
-
"Azure Storage Account": "https://
|
|
116
|
+
"Azure Event Hub": "https://learn.microsoft.com/azure/event-hubs/event-hubs-create",
|
|
117
|
+
"Azure Storage Account": "https://learn.microsoft.com/azure/storage/common/storage-account-overview"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
"type": "module",
|