
Azure Service Bus for Rust
FreeIntegrate Azure messaging with Rust applications.
Free · Opens the source repo
What Azure Service Bus for Rust does
The Azure Service Bus library for Rust provides a straightforward interface for sending and receiving messages using Azure's enterprise messaging capabilities. This library supports both queue-based and publish-subscribe messaging patterns, allowing developers to build robust applications that can handle asynchronous communication effectively. By utilizing queues, you can ensure reliable message delivery with competing consumers, while topics and subscriptions enable a more flexible message distribution model.
This skill is designed for Rust developers who need to integrate Azure Service Bus into their applications. It allows for seamless communication between services, which is essential for microservices architecture or any application requiring decoupled components. The library supports essential operations such as sending messages to queues, receiving messages from queues, and managing topics and subscriptions, making it a versatile tool for developers working with Azure.
However, it is important to note that this library is currently in early development. As such, it is not recommended for production use due to the potential for API changes. Developers should exercise caution and consider the implications of using an early-stage library in their projects. If you are looking for a stable solution for production environments, you should evaluate the official azure_messaging_servicebus crate provided by the azure-sdk on crates.io, as it is the recommended approach for integrating Azure messaging in Rust applications.
When to use it
Use this skill when building Rust applications that require Azure Service Bus for messaging, especially when implementing queue or pub-sub patterns.
When not to use it
Avoid using this skill in production environments as it is still in early development and may have unstable APIs.
What you can build with it
Sending Messages to a Queue
Use this library to send messages to an Azure Service Bus queue, ensuring reliable delivery to consumers.
Receiving Messages from a Topic Subscription
Receive messages from a subscription to a topic, allowing for a publish-subscribe messaging pattern.
Integrating with Microservices
Integrate Azure Service Bus into a microservices architecture built with Rust, facilitating communication between decoupled services.
How to install Azure Service Bus for Rust
View source1. Install with the skills CLI
npx skills add sickn33/agentic-awesome-skills/azure-servicebus-rust --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by sickn33Azure Service Bus library for Rust
When to Use
Use this skill when you need azure Service Bus library for Rust. Send and receive messages using queues, topics, and subscriptions. Triggers: "service bus rust", "ServiceBusClient rust", "send message servicebus rust", "receive message servicebus rust", "queue rust messaging", "topic subscription rust".
Client library for Azure Service Bus — enterprise message broker with queues and publish-subscribe topics.
⚠️ WARNING: This crate is in early development and SHOULD NOT be used in production. APIs may change without notice.
Use this skill when:
- An app needs to send or receive messages via Azure Service Bus from Rust
- You need queue-based messaging with competing consumers
- You need publish-subscribe messaging with topics and subscriptions
- You need reliable message delivery with completion semantics
IMPORTANT: Only use the official
azure_messaging_servicebuscrate published by the 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
cargo add azure_messaging_servicebus azure_identity tokio
If your code uses
azure_coretypes directly, addazure_coretoCargo.toml. If you only useazure_messaging_servicebusre-exports, directazure_coredependency is optional.
Environment Variables
SERVICEBUS_NAMESPACE=<namespace>.servicebus.windows.net # Required — fully qualified namespace
Key Concepts
| Concept | Description |
|---|---|
| Namespace | Container for all messaging components |
| Queue | Point-to-point messaging with competing consumers |
| Topic | Publish-subscribe messaging — one sender, many subscribers |
| Subscription | Receives messages from a topic |
| Message | Package of data and metadata, with completion/abandon semantics |
Authentication
use azure_identity::DeveloperToolsCredential;
use azure_messaging_servicebus::ServiceBusClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Local dev: DeveloperToolsCredential. Production: use ManagedIdentityCredential.
let credential = DeveloperToolsCredential::new(None)?;
let client = ServiceBusClient::builder()
.open("your_namespace.servicebus.windows.net", credential.clone())
.await?;
Ok(())
}
Core Workflow
Send a Message to a Queue
use azure_identity::DeveloperToolsCredential;
use azure_messaging_servicebus::{ServiceBusClient, Message};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credential = DeveloperToolsCredential::new(None)?;
let client = ServiceBusClient::builder()
.open("your_namespace.servicebus.windows.net", credential.clone())
.await?;
let sender = client.create_sender("my_queue", None).await?;
let message = Message::from("Hello, Service Bus!");
sender.send_message(message, None).await?;
Ok(())
}
Receive Messages from a Queue
use azure_identity::DeveloperToolsCredential;
use azure_messaging_servicebus::ServiceBusClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credential = DeveloperToolsCredential::new(None)?;
let client = ServiceBusClient::builder()
.open("your_namespace.servicebus.windows.net", credential.clone())
.await?;
let receiver = client.create_receiver("my_queue", None).await?;
let messages = receiver.receive_messages(5, None).await?;
for message in messages {
println!("Received: {}", message.body_as_string()?);
receiver.complete_message(&message, None).await?;
}
Ok(())
}
Send a Message to a Topic
let sender = client.create_sender("my_topic", None).await?;
let message = Message::from("Hello, Topic subscribers!");
sender.send_message(message, None).await?;
Receive Messages from a Subscription
let receiver = client
.create_receiver_for_subscription("my_topic", "my_subscription", None)
.await?;
let messages = receiver.receive_messages(5, None).await?;
for message in messages {
println!("Received: {}", message.body_as_string()?);
receiver.complete_message(&message, None).await?;
}
Message Settlement
| Action | Purpose |
|---|---|
complete | Remove message from queue — processing succeeded |
abandon | Release lock — message becomes available for retry |
Always complete messages after successful processing to prevent redelivery.
RBAC Roles
For Entra ID auth, assign one of these roles:
| Role | Access |
|---|---|
Azure Service Bus Data Sender | Send messages |
Azure Service Bus Data Receiver | Receive messages |
Azure Service Bus Data Owner | Full access |
Best Practices
- Use
cargo addto manage dependencies, never editCargo.tomldirectly. Add and remove Rust SDK dependencies with cargo commands instead of manual manifest edits. - Add
azure_coreonly when importingazure_coretypes directly. If your code importsazure_core::http::Url,azure_core::http::RequestContent, orazure_core::error::ErrorKind, includeazure_core; otherwise a direct dependency is optional. - Use
DeveloperToolsCredentialfor local dev,ManagedIdentityCredentialfor production — Rust does not provide a singleDefaultAzureCredentialtype - Never hardcode credentials — use environment variables or managed identity
- Assign RBAC roles — ensure the identity has appropriate Service Bus data roles
- Always complete messages — call
complete_messageafter processing to remove from queue - Use topics for fan-out — when multiple consumers need the same messages, use topics with subscriptions
- This crate is pre-production — APIs may change; pin your dependency version with cargo commands in your dependency workflow
Reference Links
Limitations
- Use this skill only when the task clearly matches its upstream source and local project context.
- Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.
- Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
Frequently asked questions about Azure Service Bus for Rust
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
