AZ

azure-eventhub-rust

Client library patterns for Azure Event Hubs streaming in Rust.

Install

mkdir -p .claude/skills/azure-eventhub-rust-rjsolucoes && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14212" && unzip -o skill.zip -d .claude/skills/azure-eventhub-rust-rjsolucoes && rm skill.zip

Installs to .claude/skills/azure-eventhub-rust-rjsolucoes

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Azure Event Hubs SDK for Rust. Use for sending and receiving events, streaming data ingestion. Triggers: "event hubs rust", "ProducerClient rust", "ConsumerClient rust", "send event rust", "streaming rust".
206 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Create a producer client for Azure Event Hubs in Rust
  • Send single events to an Event Hub
  • Send batches of events to an Event Hub
  • Create a consumer client to receive events from partitions
  • Get Event Hub properties like partition IDs

How it works

The skill uses the Azure Event Hubs SDK for Rust to create producer and consumer clients, allowing events to be sent to and received from Event Hubs.

Inputs & outputs

You give it
Event data (e.g., `vec![1, 2, 3, 4]`) or batch of event data
You get back
Events sent to or received from Azure Event Hubs

When to use azure-eventhub-rust

  • Streaming data ingestion with Event Hubs
  • Implementing producer clients in Rust
  • Consuming event partitions
  • Sending batches of events

About this skill

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 capacitytry_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

When not to use it

  • When using a different programming language than Rust
  • When not interacting with Azure Event Hubs
  • When a different event streaming platform is in use

Prerequisites

azure_messaging_eventhubsazure_identity

Limitations

  • The skill is specific to the Rust programming language
  • The skill is designed for Azure Event Hubs, not other cloud messaging services
  • Checkpointing for distributed consumers requires an additional crate

How it compares

This skill provides specific Rust SDK implementations for Azure Event Hubs, enabling direct integration and control over event streaming compared to generic messaging solutions.

Compared to similar skills

azure-eventhub-rust side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
azure-eventhub-rust (this skill)05moReviewIntermediate
add-api-version16moReviewAdvanced
solana-dev04moReviewAdvanced
mcp07moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry