[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-ebf90c9e-b150-4df3-a955-ffea1a8921ca":3,"$fYirv1-33Uz6u_BOhAL0qGRcojvPVFLgpYXh5qYVvC6Q":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"ebf90c9e-b150-4df3-a955-ffea1a8921ca","azure-eventhub-rust","Azure事件中心SDK for Rust。用于发送和接收事件，流式数据处理。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: azure-eventhub-rust\ndescription: Azure Event Hubs SDK for Rust. Use for sending and receiving events, streaming data ingestion.\nrisk: unknown\nsource: community\ndate_added: '2026-02-27'\n---\n\n# Azure Event Hubs SDK for Rust\n\nClient library for Azure Event Hubs — big data streaming platform and event ingestion service.\n\n## Installation\n\n```sh\ncargo add azure_messaging_eventhubs azure_identity\n```\n\n## Environment Variables\n\n```bash\nEVENTHUBS_HOST=\u003Cnamespace>.servicebus.windows.net\nEVENTHUB_NAME=\u003Ceventhub-name>\n```\n\n## Key Concepts\n\n- **Namespace** — container for Event Hubs\n- **Event Hub** — stream of events partitioned for parallel processing\n- **Partition** — ordered sequence of events\n- **Producer** — sends events to Event Hub\n- **Consumer** — receives events from partitions\n\n## Producer Client\n\n### Create Producer\n\n```rust\nuse azure_identity::DeveloperToolsCredential;\nuse azure_messaging_eventhubs::ProducerClient;\n\nlet credential = DeveloperToolsCredential::new(None)?;\nlet producer = ProducerClient::builder()\n    .open(\"\u003Cnamespace>.servicebus.windows.net\", \"eventhub-name\", credential.clone())\n    .await?;\n```\n\n### Send Single Event\n\n```rust\nproducer.send_event(vec![1, 2, 3, 4], None).await?;\n```\n\n### Send Batch\n\n```rust\nlet batch = producer.create_batch(None).await?;\nbatch.try_add_event_data(b\"event 1\".to_vec(), None)?;\nbatch.try_add_event_data(b\"event 2\".to_vec(), None)?;\n\nproducer.send_batch(batch, None).await?;\n```\n\n## Consumer Client\n\n### Create Consumer\n\n```rust\nuse azure_messaging_eventhubs::ConsumerClient;\n\nlet credential = DeveloperToolsCredential::new(None)?;\nlet consumer = ConsumerClient::builder()\n    .open(\"\u003Cnamespace>.servicebus.windows.net\", \"eventhub-name\", credential.clone())\n    .await?;\n```\n\n### Receive Events\n\n```rust\n\u002F\u002F Open receiver for specific partition\nlet receiver = consumer.open_partition_receiver(\"0\", None).await?;\n\n\u002F\u002F Receive events\nlet events = receiver.receive_events(100, None).await?;\nfor event in events {\n    println!(\"Event data: {:?}\", event.body());\n}\n```\n\n### Get Event Hub Properties\n\n```rust\nlet properties = consumer.get_eventhub_properties(None).await?;\nprintln!(\"Partitions: {:?}\", properties.partition_ids);\n```\n\n### Get Partition Properties\n\n```rust\nlet partition_props = consumer.get_partition_properties(\"0\", None).await?;\nprintln!(\"Last sequence number: {}\", partition_props.last_enqueued_sequence_number);\n```\n\n## Best Practices\n\n1. **Reuse clients** — create once, send many events\n2. **Use batches** — more efficient than individual sends\n3. **Check batch capacity** — `try_add_event_data` returns false when full\n4. **Process partitions in parallel** — each partition can be consumed independently\n5. **Use consumer groups** — isolate different consuming applications\n6. **Handle checkpointing** — use `azure_messaging_eventhubs_checkpointstore_blob` for distributed consumers\n\n## Checkpoint Store (Optional)\n\nFor distributed consumers with checkpointing:\n\n```sh\ncargo add azure_messaging_eventhubs_checkpointstore_blob\n```\n\n## Reference Links\n\n| Resource | Link |\n|----------|------|\n| API Reference | https:\u002F\u002Fdocs.rs\u002Fazure_messaging_eventhubs |\n| Source Code | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-rust\u002Ftree\u002Fmain\u002Fsdk\u002Feventhubs\u002Fazure_messaging_eventhubs |\n| crates.io | https:\u002F\u002Fcrates.io\u002Fcrates\u002Fazure_messaging_eventhubs |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,166,1107,"2026-05-16 13:06:24",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"4ac0fa35-9e10-464c-8760-75e9ea70e1fb","1.0.0","azure-eventhub-rust.zip",1622,"uploads\u002Fskills\u002Febf90c9e-b150-4df3-a955-ffea1a8921ca\u002Fazure-eventhub-rust.zip","357d08e3fb65ffde96bc00d04df4906160bb2ae480a1b89b1f6c1a7902088f73","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":3766}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]