Skip to content

Commit 189d374

Browse files
Reformat checkpoint store readme to match the style of other SDK readme files (#2883)
Fixes #2872 --------- Co-authored-by: Copilot <[email protected]>
1 parent bfde39a commit 189d374

File tree

1 file changed

+100
-26
lines changed
  • sdk/eventhubs/azure_messaging_eventhubs_checkpointstore_blob

1 file changed

+100
-26
lines changed

sdk/eventhubs/azure_messaging_eventhubs_checkpointstore_blob/README.md

Lines changed: 100 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Azure Event Hubs Checkpoint Store for Blob Storage
23

34
This crate provides a checkpoint store implementation for Azure Event Hubs using Azure Blob Storage as the backend. It implements the `CheckpointStore` trait from the `azure_messaging_eventhubs` crate, allowing you to persist checkpoints (event positions) to Azure Blob Storage.
@@ -9,18 +10,64 @@ This crate provides a checkpoint store implementation for Azure Event Hubs using
910
- **Concurrency Support**: Handle multiple processors with proper concurrency control
1011
- **Easy Integration**: Drop-in replacement for other checkpoint store implementations
1112

12-
## Usage
13+
[Source code] | [Package (crates.io)] | [API reference documentation] | [Product documentation]
14+
15+
## Getting started
16+
17+
### Install the package(s)
18+
19+
Install the Azure Event Hubs, Azure Blob Storage, and Blob Checkpoint Store client libraries for Rust with [Cargo]:
20+
21+
```sh
22+
cargo add azure_messaging_eventhubs
23+
cargo add azure_storage_blob
24+
cargo add azure_messaging_eventhubs_checkpointstore_blob
25+
```
26+
27+
### Prerequisites
28+
29+
- A Rust Compiler. See [the rust compiler installation instructions](https://www.rust-lang.org/tools/install).
30+
- An [Azure subscription]
31+
- The [Azure CLI]
32+
- An [Event Hub namespace](https://learn.microsoft.com/azure/event-hubs/).
33+
- An Event Hub instance. You can create an Event Hub instance in your Event Hubs Namespace using the [Azure Portal](https://learn.microsoft.com/azure/event-hubs/event-hubs-create), or the [Azure CLI](https://learn.microsoft.com/azure/event-hubs/event-hubs-quickstart-cli).
34+
35+
If you use the Azure CLI, replace `<your-resource-group-name>`, `<your-eventhubs-namespace-name>`, and `<your-eventhub-name>` with your own, unique names:
36+
37+
Create an Event Hubs Namespace:
38+
39+
```azurecli
40+
az eventhubs namespace create --resource-group <your-resource-group-name> --name <your-eventhubs-namespace-name> --sku Standard
41+
```
42+
43+
Create an Event Hub Instance:
44+
45+
```azurecli
46+
az eventhubs eventhub create --resource-group <your-resource-group-name> --namespace-name <your-eventhubs-namespace-name> --name <your-eventhub-name>
47+
```
48+
49+
### Install dependencies
50+
51+
Add the following crates to your project:
52+
53+
```sh
54+
cargo add azure_identity tokio azure_messaging_eventhubs azure_storage_blob
55+
```
56+
57+
### Authenticate the client
1358

14-
Add this to your `Cargo.toml`:
59+
Before interacting with Azure services, you need a credential to use to authenticate and authorize the user.
1560

16-
```toml
17-
[dependencies]
18-
azure_messaging_eventhubs_checkpointstore_blob = "0.1.0"
19-
azure_messaging_eventhubs = "0.20.0"
20-
azure_storage_blobs = "0.20.0"
21-
azure_identity = "0.20.0"
61+
The example shown below uses a [`DefaultAzureCredential`][default_cred_ref], which is appropriate for most local development environments. Additionally, we recommend using a managed identity for authentication in production environments. You can find more information on different ways of authenticating and their corresponding credential types in the [Azure Identity] documentation.
62+
63+
The `DefaultAzureCredential` will automatically pick up on an Azure CLI authentication. Ensure you are logged in with the Azure CLI:
64+
65+
```azurecli
66+
az login
2267
```
2368

69+
Instantiate a `DefaultAzureCredential` to pass to the client. The same instance of a token credential can be used with multiple clients if they will be authenticating with the same identity.
70+
2471
### Basic Example
2572

2673
This example creates a blob container client on the storage account which will hold the blob checkpoint store, and configures a blob checkpoint store to use that storage client.
@@ -72,27 +119,54 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
72119
}
73120
```
74121

75-
## Container Structure
76-
77-
The checkpoint store creates blobs in the following structure:
78-
79-
```text
80-
container/
81-
├── prefix/
82-
│ ├── eventhub-name/
83-
│ │ ├── consumer-group/
84-
│ │ │ ├── partition-0
85-
│ │ │ ├── partition-1
86-
│ │ │ └── ...
87-
│ │ └── ownership/
88-
│ │ ├── owner-1.json
89-
│ │ ├── owner-2.json
90-
│ │ └── ...
91-
```
92-
93122
## Examples
94123

95124
See the `examples/` directory for more detailed usage examples:
96125

97126
- `checkpoint_store_basic.rs`: Basic checkpoint operations
98127
- `processor_with_blob_checkpoints.rs`: Complete EventHubs processor setup
128+
129+
## Troubleshooting
130+
131+
### General
132+
133+
When you interact with the Azure Event Hubs Checkpoint Store using the Rust SDK, errors returned by the service are returned as `azure_core::Error` values. However in general, client applications will not interact with the Checkpoint Store - the Checkpoint Store functionality is primarily used by the Event Hubs event processor.
134+
135+
### Logging
136+
137+
The Event Hubs SDK client uses the [tracing](https://docs.rs/tracing/latest/tracing/) package to
138+
enable diagnostics.
139+
140+
## Contributing
141+
142+
See the [CONTRIBUTING.md] for details on building, testing, and contributing to these libraries.
143+
144+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit <https://opensource.microsoft.com/cla/>.
145+
146+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
147+
148+
This project has adopted the [Microsoft Open Source Code of Conduct]. For more information see the [Code of Conduct FAQ] or contact <[email protected]> with any additional questions or comments.
149+
150+
### Reporting security issues and security bugs
151+
152+
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <[email protected]>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).
153+
154+
### License
155+
156+
Azure SDK for Rust is licensed under the [MIT](https://github.com/Azure/azure-sdk-for-cpp/blob/main/LICENSE.txt) license.
157+
158+
<!-- LINKS -->
159+
<!--[API reference documentation]: https://docs.rs/azure_messaging_eventhubs_checkpointstore_blob/latest/azure_messaging_eventhubs_checkpointstore_blob-->
160+
[API reference documentation]: https://docs.rs/azure_messaging_eventhubs/latest/azure_messaging_eventhubs
161+
[Azure CLI]: https://learn.microsoft.com/cli/azure
162+
[Azure subscription]: https://azure.microsoft.com/free/
163+
[Azure Identity]: https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/identity/azure_identity
164+
[Microsoft Open Source Code of Conduct]: https://opensource.microsoft.com/codeofconduct/
165+
[Product documentation]: https://learn.microsoft.com/azure/event-hubs/
166+
[Cargo]: https://crates.io/
167+
<!--[Package (crates.io)]: https://crates.io/crates/azure_messaging_eventhubs_checkpointstore_blob-->
168+
[Package (crates.io)]: https://crates.io/crates/azure_messaging_eventhubs
169+
[Source code]: https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/eventhubs/azure_messaging_eventhubs_checkpointstore_blob/src
170+
[CONTRIBUTING.md]: https://github.com/Azure/azure-sdk-for-rust/blob/main/CONTRIBUTING.md
171+
[Code of Conduct FAQ]: https://opensource.microsoft.com/codeofconduct/faq/
172+
[default_cred_ref]: https://docs.rs/azure_identity/latest/azure_identity/struct.DefaultAzureCredential.html

0 commit comments

Comments
 (0)