azeventhubs

所属分类:Rust编程
开发工具:Rust
文件大小:0KB
下载次数:0
上传日期:2023-12-06 21:26:39
上 传 者sh-1993
说明:  AMQP 1.0上的非正式Azure事件中心SDK,以防生锈
(Unofficial Azure Event Hubs SDK over AMQP 1.0 for rust)

文件列表:
CHANGELOG.md (3307, 2023-12-13)
Cargo.toml (2598, 2023-12-13)
benches/ (0, 2023-12-13)
benches/bench_consumer_client_start_up.rs (6606, 2023-12-13)
benches/bench_event_stream.rs (4636, 2023-12-13)
benches/bench_event_stream_start_up.rs (4091, 2023-12-13)
benches/utils.rs (5634, 2023-12-13)
examples/ (0, 2023-12-13)
examples/consumer_read_from_position.rs (2851, 2023-12-13)
examples/event_hub_connection_example.rs (558, 2023-12-13)
examples/event_hub_consumer_example.rs (1631, 2023-12-13)
examples/event_hub_producer_example.rs (962, 2023-12-13)
examples/event_hub_producer_send_batch.rs (1573, 2023-12-13)
examples/event_hub_spawn_consumer_example.rs (2343, 2023-12-13)
examples/producer_with_azure_identity_credential.rs (981, 2023-12-13)
examples/read_iothub_builtin_endpoints.rs (1684, 2023-12-13)
examples/spawn_multiple_consumer.rs (3137, 2023-12-13)
src/ (0, 2023-12-13)
src/amqp/ (0, 2023-12-13)
src/amqp/amqp_cbs_link.rs (13833, 2023-12-13)
src/amqp/amqp_client.rs (16401, 2023-12-13)
src/amqp/amqp_connection.rs (2256, 2023-12-13)
src/amqp/amqp_connection_scope.rs (28692, 2023-12-13)
src/amqp/amqp_constants.rs (3326, 2023-12-13)
src/amqp/amqp_consumer/ (0, 2023-12-13)
src/amqp/amqp_consumer/mod.rs (7500, 2023-12-13)
src/amqp/amqp_consumer/multiple.rs (10651, 2023-12-13)
src/amqp/amqp_consumer/single.rs (9318, 2023-12-13)
src/amqp/amqp_event_batch.rs (8036, 2023-12-13)
src/amqp/amqp_filter.rs (2639, 2023-12-13)
src/amqp/amqp_management/ (0, 2023-12-13)
src/amqp/amqp_management/event_hub_properties.rs (4432, 2023-12-13)
src/amqp/amqp_management/mod.rs (2644, 2023-12-13)
src/amqp/amqp_management/partition_properties.rs (5792, 2023-12-13)
src/amqp/amqp_management_link.rs (983, 2023-12-13)
src/amqp/amqp_message_converter.rs (5935, 2023-12-13)
src/amqp/amqp_message_extension.rs (12872, 2023-12-13)
src/amqp/amqp_phantom_message.rs (12770, 2023-12-13)
... ...

# azeventhubs An unofficial and experimental Azure Event Hubs client library for Rust. This crate follows a similar structure to that of the [Azure SDK for .Net](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/eventhub/Azure.Messaging.EventHubs), and thus it should be familiar to anyone who has used the dotnet SDK. This crate is still in development, and not all features are implemented yet. ## Examples ### Event Hub Producer Example ```rust use azeventhubs::producer::{ EventHubProducerClient, EventHubProducerClientOptions, SendEventOptions, }; #[tokio::main] async fn main() -> Result<(), Box> { let mut producer_client = EventHubProducerClient::new_from_connection_string( "", // Replace with your connection string "".to_string(), // Replace with your hub name EventHubProducerClientOptions::default() ).await?; let partition_ids = producer_client.get_partition_ids().await?; let event = "Hello, world to first partition!"; let options = SendEventOptions::new().with_partition_id(&partition_ids[0]); producer_client.send_event(event, options).await?; producer_client.close().await?; Ok(()) } ``` ### Event Hub Consumer Example ```rust use futures_util::StreamExt; use azeventhubs::consumer::{EventHubConsumerClient, EventHubConsumerClientOptions, EventPosition, ReadEventOptions}; #[tokio::main] async fn main() -> Result<(), Box> { // Create a consumer client let mut consumer_client = EventHubConsumerClient::new_from_connection_string( EventHubConsumerClient::DEFAULT_CONSUMER_GROUP_NAME, "", // Replace with your connection string "".to_string(), // Replace with your hub name EventHubConsumerClientOptions::default(), ).await?; let partition_ids = consumer_client.get_partition_ids().await?; let starting_position = EventPosition::earliest(); let options = ReadEventOptions::default(); // Get a stream of events from the first partition let mut stream = consumer_client .read_events_from_partition(&partition_ids[0], starting_position, options) .await?; // Receive 30 events let mut counter = 0; while let Some(event) = stream.next().await { let event = event?; let body = event.body()?; let value = std::str::from_utf8(body)?; log::info!("{:?}", value); log::info!("counter: {}", counter); counter += 1; if counter > 30 { break; } } // Close the stream stream.close().await?; // Close the consumer client consumer_client.close().await?; Ok(()) } ``` ## What is implemented and what is not? | Feature | Supported | | ------- | --------- | | Event Hub Connection | Yes | | Event Hub Producer | Yes | | Event Hub Consumer | Yes | | Partition Receiver | Yes | | Event Hub Buffered Producer | Not yet | | Event Hub Processor | Not yet | | Checkpoint Store | Not yet | ## TLS Support Communication between a client application and an Azure Service Event Hub namespace is encrypted using Transport Layer Security (TLS). The TLS implementation is exposed to the user through the corresponding feature flags (please see the feature flag section below). The user should ensure either the `rustls` or `native-tls` feature is enabled, and one and only one TLS implementation must be enabled. Enabling both features is **not** supported and will result in an error. The `native-tls` feature is enabled by default, and it will use the `native-tls` crate to provide TLS support. The `rustls` feature will use the `rustls` crate and `webpki-roots` crate to provide TLS support. ## Feature Flags This crate supports the following feature flags: | Feature | Description | | ------- | ----------- | | `default` | Enables "native-tls" feature | | `rustls` | Enables the use of the `rustls` crate for TLS support | | `native-tls` | Enables the use of the `native-tls` crate for TLS support | ## WebAssembly Support WebAssembly is **NOT** supported yet. License: MIT

近期下载者

相关文件


收藏者