技能 Azure Event Hubs SDK for Rust
📦

Azure Event Hubs SDK for Rust

安全

Stream Events with Azure Event Hubs in Rust

Building event-driven applications in Rust requires reliable event ingestion. This skill provides official Azure Event Hubs SDK patterns for producers and consumers.

支持: Claude Codex Code(CC)
📊 69 充足
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“Azure Event Hubs SDK for Rust”。 Send a batch of sensor readings to Event Hubs

预期结果:

Successfully sent batch with 50 events to partition 2. Batch size: 4096 bytes. Sequence numbers: 1001-1050

正在使用“Azure Event Hubs SDK for Rust”。 Receive events from partition 0 with checkpointing

预期结果:

Received 25 events from partition 0. Last sequence number: 2847. Checkpoint saved to blob storage. Processing time: 120ms

安全审计

安全
v1 • 2/24/2026

This skill contains documentation-only content for the Azure Event Hubs Rust SDK. No executable code, scripts, or dangerous patterns detected. Static analysis scanned 0 files with 0 risk factors. The skill provides guidance on using Azure's official Rust client library for event streaming.

0
已扫描文件
0
分析行数
0
发现项
1
审计总数
未发现安全问题
审计者: claude

质量评分

38
架构
100
可维护性
87
内容
31
社区
100
安全
74
规范符合性

你能构建什么

Real-time Data Ingestion Pipeline

Build scalable event producers to ingest streaming data from IoT devices or application logs into Azure Event Hubs for downstream processing

Event-Driven Microservices

Implement consumer clients to process events from specific partitions enabling parallel consumption across microservice instances

Telemetry Collection System

Deploy Rust-based event collectors that batch and send telemetry data efficiently with proper error handling and retry logic

试试这些提示

Basic Event Producer
Create a Rust function that uses the Azure Event Hubs SDK to send a single event with a JSON payload to the configured event hub
Batch Event Submission
Write Rust code that creates an event batch, adds multiple events with metadata, checks batch capacity, and sends the batch to Azure Event Hubs
Partition-Aware Consumer
Implement a Rust consumer that opens receivers for all partitions, receives events from each partition concurrently, and prints event metadata
Checkpointed Distributed Consumer
Build a Rust application that uses ConsumerClient with Blob checkpoint store to track processing progress and enable failover recovery for distributed consumption

最佳实践

  • Reuse ProducerClient and ConsumerClient instances instead of creating new ones for each operation
  • Use batch sends instead of individual events to improve throughput and reduce latency
  • Implement checkpointing with Blob storage when running distributed consumers for reliable recovery

避免

  • Creating new client instances for every event instead of reusing connections
  • Sending events individually in a loop without batching when throughput matters
  • Ignoring batch capacity limits which can cause event loss or send failures

常见问题

How do I authenticate to Azure Event Hubs with this Rust SDK?
Use the DeveloperToolsCredential from azure_identity crate for local development. For production, use ManagedIdentityCredential or ServicePrincipalCredential with appropriate Azure RBAC permissions.
What is the maximum batch size for Event Hubs?
The maximum batch size depends on your Event Hubs tier. Basic tier allows 256 KB per batch, Standard allows 1 MB, and Premium allows up to 4 MB. Use try_add_event_data to check capacity before adding events.
How do I handle partition rebalancing in distributed consumers?
Use the checkpoint store feature with azure_messaging_eventhubs_checkpointstore_blob. It coordinates partition ownership across consumer instances and enables automatic failover when instances go offline.
Can I send events to a specific partition?
Yes, include a partition_key in the event options when calling send_event or add_event_data. Events with the same partition key always route to the same partition, enabling ordered processing.
What happens if event send fails due to network issues?
The SDK returns a Result with an error variant. Implement retry logic with exponential backoff. Consider using transaction IDs for idempotent sends to avoid duplicates during retries.
How do I monitor Event Hubs throughput and latency?
Use Azure Monitor metrics for Event Hubs namespace. Track IncomingMessages, OutgoingMessages, and Requests metrics. For application-level monitoring, instrument send and receive operations with tracing spans.

开发者详情

文件结构

📄 SKILL.md