agentsclimarketplace

Azure eventhub rust

Skill ComeOnOliver/skillshub/skills/microsoft/skills/azure-eventhub-rust

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill azure-eventhub-rust

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

3.1 KB, 714 tokens by cl100k_base, as published. Nobody here has run it

Azure Event Hubs SDK for Rust

Client library for Azure Event Hubs β€” big data streaming platform and event ingestion service.

Installation

cargo add azure_messaging_eventhubs azure_identity

Environment Variables

EVENTHUBS_HOST=<namespace>.servicebus.windows.net
EVENTHUB_NAME=<eventhub-name>

Key Concepts

  • Namespace β€” container for Event Hubs
  • Event Hub β€” stream of events partitioned for parallel processing
  • Partition β€” ordered sequence of events
  • Producer β€” sends events to Event Hub
  • Consumer β€” receives events from partitions

Producer Client

Create Producer

use azure_identity::DeveloperToolsCredential;
use azure_messaging_eventhubs::ProducerClient;

let credential = DeveloperToolsCredential::new(None)?;
let producer = ProducerClient::builder()
    .open("<namespace>.servicebus.windows.net", "eventhub-name", credential.clone())
    .await?;

Send Single Event

producer.send_event(vec![1, 2, 3, 4], None).await?;

Send Batch

let batch = producer.create_batch(None).await?;
batch.try_add_event_data(b"event 1".to_vec(), None)?;
batch.try_add_event_data(b"event 2".to_vec(), None)?;

producer.send_batch(batch, None).await?;

Consumer Client

Create Consumer

use azure_messaging_eventhubs::ConsumerClient;

let credential = DeveloperToolsCredential::new(None)?;
let consumer = ConsumerClient::builder()
    .open("<namespace>.servicebus.windows.net", "eventhub-name", credential.clone())
    .await?;

Receive Events

// Open receiver for specific partition
let receiver = consumer.open_partition_receiver("0", None).await?;

// Receive events
let events = receiver.receive_events(100, None).await?;
for event in events {
    println!("Event data: {:?}", event.body());
}

Get Event Hub Properties

let properties = consumer.get_eventhub_properties(None).await?;
println!("Partitions: {:?}", properties.partition_ids);

Get Partition Properties

let partition_props = consumer.get_partition_properties("0", None).await?;
println!("Last sequence number: {}", partition_props.last_enqueued_sequence_number);

Best Practices

  1. Reuse clients β€” create once, send many events
  2. Use batches β€” more efficient than individual sends
  3. Check batch capacity β€” try_add_event_data returns false when full
  4. Process partitions in parallel β€” each partition can be consumed independently
  5. Use consumer groups β€” isolate different consuming applications
  6. Handle checkpointing β€” use azure_messaging_eventhubs_checkpointstore_blob for distributed consumers

Checkpoint Store (Optional)

For distributed consumers with checkpointing:

cargo add azure_messaging_eventhubs_checkpointstore_blob

Reference Links

ResourceLink
API Referencehttps://docs.rs/azure_messaging_eventhubs
Source Codehttps://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/eventhubs/azure_messaging_eventhubs
crates.iohttps://crates.io/crates/azure_messaging_eventhubs

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.