Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #3988

azure-servicebus-rust

Skill này làm gì

Công cụ này cho phép các chương trình viết bằng Rust gửi và nhận thông điệp qua Azure Service Bus. Nó hoạt động như một hệ thống bưu chính để các phần của chương trình giao tiếp đáng tin cậy.

Khi nào nên dùng

  • ✓Khi một chương trình Rust cần gửi hoặc nhận dữ liệu từ các hệ thống khác.
  • ✓Khi bạn xây dựng hệ thống mà nhiều phần giao tiếp bằng cách trao đổi thông điệp.
  • ✓Khi bạn muốn đảm bảo thông điệp quan trọng không bị mất và vẫn được xử lý dù chương trình tạm thời gặp lỗi.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-servicebus-rust/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-servicebus-rust/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để chương trình Rust của tôi gửi một thông điệp đến hàng đợi “orders” trong Azure Service Bus?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Chương trình Rust kết nối với Azure Service Bus bằng thông tin xác thực. Sau đó, nó có thể tạo “sender” để gửi thông điệp đến queue hoặc topic, và “receiver” để đọc thông điệp từ đó.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Azure 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_servicebus crate 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_core types directly, add azure_core to Cargo.toml. If you only use azure_messaging_servicebus re-exports, direct azure_core dependency 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 {

…
Câu hỏi thường gặp

Azure Service Bus là gì?

Đây là dịch vụ của Microsoft đóng vai trò trung gian nhắn tin. Nó cho phép các ứng dụng gửi và nhận thông điệp đáng tin cậy, ngay cả khi chúng không cùng trực tuyến.

Queue và topic là gì?

Queue dùng cho giao tiếp điểm-điểm (một thông điệp đến một người nhận). Topic dùng cho mô hình xuất bản/đăng ký (một thông điệp có thể đến nhiều người nhận).

Tôi có thể dùng cái này trong môi trường thực tế không?

Không nên. Đoạn mã này vẫn đang trong giai đoạn phát triển sớm và không khuyến nghị dùng cho sản phẩm thực tế. Tính năng có thể thay đổi.

Chi tiết

Mô tả gốc của tác giả

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".

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3988
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự