azure-eventhub-rust 是什么?
azure-eventhub-rust 使用官方azure_messaging_eventhubs crate发送流事件和从分区消费,覆盖batch、Earliest/Latest起点与ReceivedEventData包裹体。它适合流式采集,不等同于有任务完成删除语义的Queue Storage。
中文说明由本站依据来源整理;英文原文保留在页面下方。
怎么接入你的 Agent?
- 定位完整 Skill 目录
打开本项目来源,核对
SKILL.md及其引用的脚本和资料。 - 交给你正在用的 Agent
在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。
- 确认识别,再做具体任务
让 Agent 回报安装目录和识别到的名称
azure-eventhub-rust,然后按本页使用示例提供材料。
展开并复制给 Codex 的安装指令
安装并检查 azure-eventhub-rust
请在 Codex 的当前工作环境中安装并检查 azure-eventhub-rust 这个 Skill。
项目身份:microsoft/skills / azure-eventhub-rust
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Claude Code 的安装指令
安装并检查 azure-eventhub-rust
请在 Claude Code 的当前工作环境中安装并检查 azure-eventhub-rust 这个 Skill。
项目身份:microsoft/skills / azure-eventhub-rust
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Cursor 的安装指令
安装并检查 azure-eventhub-rust
请在 Cursor Agent 的当前工作环境中安装并检查 azure-eventhub-rust 这个 Skill。
项目身份:microsoft/skills / azure-eventhub-rust
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 当前 Agent 的安装指令
安装并检查 azure-eventhub-rust
请在 当前 Agent 的当前工作环境中安装并检查 azure-eventhub-rust 这个 Skill。
项目身份:microsoft/skills / azure-eventhub-rust
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。装好以后,具体怎么用?
准备哪些材料
- 准备完整namespace host、Event Hub名称、分区与读取起点;添加官方crate、identity、tokio/futures,并按发送或接收角色授权。
会得到什么
- Rust发送或分区接收代码、明确的起点/事件体处理与错误分支。
实际使用顺序
- ProducerClient与ConsumerClient通过builder.open创建,按绑定签名分别传hub name的&str或String;DeveloperToolsCredential已返回Arc,可直接clone,不额外套错误类型。
- 发送批量先create_batch再try_add_event_data并检查容量失败,最后send_batch;不能忽略try_add失败就宣称所有事件已进批次。
- 消费用open_receiver_on_partition与明确StartPosition,按事件流逐项处理Ok/Err;正文从event.event_data().body()取,不从外层event.body()猜API。接收起点与后续checkpoint/恢复设计要分开。
从一个具体任务开始
本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。
复制一个具体任务
教学任务:使用 azure-eventhub-rust,为现有Event Hub写一个分区0、Latest起点的消费示例,逐事件处理错误,从event.event_data().body()读取正文并限制演示数量。只给代码,不连接Hub,不发送事件;同时说明该示例未实现checkpoint持久化。预期得到符合官方crate形状的接收代码;本站未读取或发送事件。
使用条件与边界
- Earliest会读取历史流而Latest从新事件开始,不能无条件用Earliest当生产默认。
- 绑定源未提供完整checkpoint/分区负载均衡方案,不能把单分区流循环称为生产消费者集群。
常见问题
为什么event.body()编译不过?
绑定源的ReceivedEventData是包装对象,正文在内部EventData上,应通过event.event_data().body()读取,并处理可能无body的情况。
来源原文与资料状态
- 源文件
- 已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
- 中文使用说明
- 已针对下方源文件版本整理用途、用法和常见问题
- 安装与任务测试
- 本站未执行安装或任务测试
- 来源复核
- 本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料
.github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z
以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。
抓取成功不代表已完成安装或任务测试。
Azure Event Hubs library for Rust. Send and receive events for streaming data ingestion and batch processing. Triggers: "event hubs rust", "ProducerClient rust", "ConsumerClient rust", "send event rust", "streaming rust", "eventhub rust".
查看源文件章节 / Source sections
- 原文:Azure Event Hubs library for Rust
- 安装 / Installation
- 原文:Environment Variables
- 原文:Key Concepts
- 原文:Authentication
- 原文:Core Workflow
- 原文:Send Events
- 原文:Send Batch
- 原文:Receive Events
- 原文:Receive from Partition
- 原文:RBAC Roles
- 原文:Best Practices
- 原文:Reference Links
原文:Azure Event Hubs library for Rust
Client library for Azure Event Hubs — send and receive events for streaming data ingestion. Use this skill when: - An app needs to send events to Azure Event Hubs from Rust - You need to receive and process events from partitions - You need batch sending for throughput optimization - You need to control consumer start position > **IMPORTANT:** Only use the official `azure_messaging_eventhubs` crate published by the [azure-sdk](https://crates.io/users/azure-sdk) crates.io user. Do NOT use unofficial or community crates. Official crates use underscores in names and none have version 0.21.0.
安装 / Installation
```sh cargo add azure_messaging_eventhubs azure_identity tokio futures ``` > `DeveloperToolsCredential::new(None)?` already returns an `Arc<DeveloperToolsCredential>`, so you can pass or clone it directly into `.open()`. Add `azure_core` only when you need direct `azure_core` imports such as `ErrorKind`.
原文:Environment Variables
```bash EVENTHUBS_HOST=<namespace>.servicebus.windows.net # Required — fully qualified namespace EVENTHUB_NAME=<eventhub-name> # Required — name of the Event Hub ```
原文:Key Concepts
| Concept | Description | | ------------- | ---------------------------------------------------- | | **Namespace** | Container for one or more Event Hubs | | **Event Hub** | Stream of events, partitioned for parallel reads | | **Partition** | Ordered, append-only sequence of events | | **Producer** | Sends events via `ProducerClient` | | **Consumer** | Receives events from partitions via `ConsumerClient` |
原文:Authentication
Rust Azure SDK code must not use `DefaultAzureCredential`. The Rust identity crate does not provide that type. ```rust use azure_identity::DeveloperToolsCredential; use azure_messaging_eventhubs::ProducerClient; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { // Local dev: DeveloperToolsCredential. Production: use ManagedIdentityCredential. let credential = DeveloperToolsCredential::new(None)?; let producer = ProducerClient::builder() .open( "<namespace>.servicebus.windows.net", "<eventhub-name>", credential.clone(), ) .await?; Ok(()) } ``` Prefer the crate README/examples when checking builder signatures and receive-stream event wrapper shapes.
原文:Send Events
```rust // Send a single event producer.send_event(vec![1, 2, 3, 4], None).await?; ```
文件 SHA256:ebfc903a96b4aa25c2ef83021ef90e02306ce56cf01943244f4bc3f4f3980278
仓库许可证记录:MIT;skill-declaration-captured-not-interpreted,查看来源。
Azure Event Hubs library for Rust. Send and receive events for streaming data ingestion and batch processing. Triggers: "event hubs rust", "ProducerClient rust", "ConsumerClient rust", "send event rust", "streaming rust", "eventhub rust".
历史收录数据
| 来源仓库 | microsoft/skills |
|---|---|
| Skill源路径 | .github/plugins/azure-sdk-rust/skills/azure-eventhub-rust/SKILL.md |
安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。
