@azure/eventhubs-checkpointstore-table 1.0.0-alpha.20250107.2 → 1.0.0-alpha.20250114.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 -14
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
An Azure Table 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](#)
|
|
7
8
|
- [Package (npm)](https://www.npmjs.com/package/@azure/eventhubs-checkpointstore-table)
|
|
8
9
|
- [API Reference Documentation](#)
|
|
@@ -11,16 +12,17 @@ Key Links:
|
|
|
11
12
|
## Getting started
|
|
12
13
|
|
|
13
14
|
### Currently supported environments
|
|
15
|
+
|
|
14
16
|
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
|
|
15
17
|
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
|
16
18
|
|
|
17
19
|
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
|
18
20
|
|
|
19
|
-
|
|
20
21
|
### Prerequisites
|
|
22
|
+
|
|
21
23
|
- An [Azure subscription](https://azure.microsoft.com/free/)
|
|
22
|
-
- An [Event Hubs Namespace](https://
|
|
23
|
-
- A [Storage account](https://
|
|
24
|
+
- An [Event Hubs Namespace](https://learn.microsoft.com/azure/event-hubs/) to use this package
|
|
25
|
+
- A [Storage account](https://learn.microsoft.com/azure/storage/tables/table-storage-overview)
|
|
24
26
|
|
|
25
27
|
### Install the package
|
|
26
28
|
|
|
@@ -56,12 +58,9 @@ You also need to enable `compilerOptions.allowSyntheticDefaultImports` in your t
|
|
|
56
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.
|
|
57
59
|
Through this mechanism, checkpointing enables both failover resiliency and event stream replay.
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
61
|
A [TableCheckpointStore](#)
|
|
62
62
|
is a class that implements key methods required by the EventHubConsumerClient to balance load and update checkpoints.
|
|
63
63
|
|
|
64
|
-
|
|
65
64
|
## Examples
|
|
66
65
|
|
|
67
66
|
- [Create a CheckpointStore using Azure Table Storage](#create-a-checkpointstore-using-azure-table-storage)
|
|
@@ -81,16 +80,16 @@ if (!tableClient.exists()) {
|
|
|
81
80
|
await tableClient.create(); // This can be skipped if the table already exists
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
const checkpointStore =
|
|
83
|
+
const checkpointStore = new TableCheckpointStore(tableClient);
|
|
85
84
|
```
|
|
86
85
|
|
|
87
86
|
### Checkpoint events using Azure Table storage
|
|
88
87
|
|
|
89
88
|
To checkpoint events received using Azure Table Storage, you will need to pass an object
|
|
90
|
-
that is compatible with the [SubscriptionEventHandlers](https://
|
|
89
|
+
that is compatible with the [SubscriptionEventHandlers](https://learn.microsoft.com/javascript/api/@azure/event-hubs/subscriptioneventhandlers)
|
|
91
90
|
interface along with code to call the `updateCheckpoint()` method.
|
|
92
91
|
|
|
93
|
-
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.
|
|
94
93
|
|
|
95
94
|
```javascript
|
|
96
95
|
const { EventHubConsumerClient } = require("@azure/event-hubs");
|
|
@@ -115,7 +114,7 @@ async function main() {
|
|
|
115
114
|
consumerGroup,
|
|
116
115
|
eventHubConnectionString,
|
|
117
116
|
eventHubName,
|
|
118
|
-
checkpointStore
|
|
117
|
+
checkpointStore,
|
|
119
118
|
);
|
|
120
119
|
|
|
121
120
|
const subscription = consumerClient.subscribe({
|
|
@@ -138,7 +137,7 @@ async function main() {
|
|
|
138
137
|
// handle any errors that occur during the course of
|
|
139
138
|
// this subscription
|
|
140
139
|
console.log(`Errors in subscription to partition ${context.partitionId}: ${err}`);
|
|
141
|
-
}
|
|
140
|
+
},
|
|
142
141
|
});
|
|
143
142
|
|
|
144
143
|
// Wait for a few seconds to receive events before closing
|
|
@@ -209,12 +208,9 @@ export DEBUG=azure:eventhubs-checkpointstore-table:info
|
|
|
209
208
|
|
|
210
209
|
## Next steps
|
|
211
210
|
|
|
212
|
-
|
|
213
|
-
|
|
214
211
|
Please take a look at the [samples](#)
|
|
215
212
|
directory for detailed example.
|
|
216
213
|
|
|
217
|
-
|
|
218
214
|
## Contributing
|
|
219
215
|
|
|
220
216
|
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md)to learn more about how to build and test the code.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/eventhubs-checkpointstore-table",
|
|
3
3
|
"sdk-type": "client",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.20250114.1",
|
|
5
5
|
"description": "An Azure Storage Table solution to store checkpoints when using Event Hubs.",
|
|
6
6
|
"author": "Microsoft Corporation",
|
|
7
7
|
"license": "MIT",
|