Skill

Integrate with Azure Service Bus for Messaging

A Python skill for azure-servicebus: send and receive queue and topic messages, sessions, scheduling, and dead-letter handling.

Works with azure

88
Spark score
out of 100
Updated 23 days ago
Source checked Oct 15, 2026
Version 19.7.0

Add to Favorites

Why it matters

Leverage Azure Service Bus for reliable cloud-based messaging. This skill enables sending and receiving messages using queues and pub/sub topics, facilitating robust communication between applications.

Outcomes

What it gets done

01

Send messages to Azure Service Bus queues and topics.

02

Receive messages from Azure Service Bus queues and subscriptions.

03

Manage message delivery with options like Peek-Lock and Receive-and-Delete.

04

Implement message processing with completion, abandonment, and dead-lettering.

Install

Add it to your toolbox

Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-azure-servicebus-py | bash

After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.

Reports

Agent outcome reports

No reports yet

Overview

This skill covers the azure-servicebus Python SDK for queue and topic messaging: sending single or batched messages, receiving and settling them with complete, abandon, defer, or dead-letter actions, session-based FIFO processing, scheduled messages, and dead-letter queue handling, in both sync and async clients. Use it when writing Python code that sends or consumes messages through Azure Service Bus queues or topics and subscriptions, including ordered sessions, scheduled delivery, or poison-message handling.

What it does

This skill teaches an agent to use the azure-servicebus Python SDK for enterprise messaging over Azure Service Bus queues and pub/sub topics. From a ServiceBusClient, it gets a ServiceBusSender (get_queue_sender() or get_topic_sender()) and a ServiceBusReceiver (get_queue_receiver() or get_subscription_receiver()), sends single messages, lists of messages, or size-controlled ServiceBusMessage batches, and receives messages with receive_messages(max_message_count, max_wait_time). It covers both the async client (azure.servicebus.aio, the recommended one for production) and a sync client for simple scripts, plus session-based FIFO messaging, scheduled and cancellable messages, and reading from a queue's or subscription's dead-letter sub-queue. A session-aware receiver can pin to a known session_id or claim whichever session is available next via NEXT_AVAILABLE_SESSION.

When to use - and when NOT to

Use it when writing Python code that sends or consumes messages through Azure Service Bus queues or topics/subscriptions - reliable delivery, ordered processing via sessions, scheduled delivery, or poison-message handling. It is a client-usage reference, not a guide to provisioning the Service Bus namespace itself. Its stated best practices: use the async client for production workloads, use context managers (async with) for proper cleanup, complete messages only after successful processing, route poison messages to the dead-letter queue, use sessions for ordered FIFO processing, batch messages for high-throughput scenarios, and set max_wait_time to avoid blocking indefinitely.

Inputs and outputs

Inputs: SERVICEBUS_FULLY_QUALIFIED_NAMESPACE, SERVICEBUS_QUEUE_NAME, SERVICEBUS_TOPIC_NAME, and SERVICEBUS_SUBSCRIPTION_NAME as environment variables, a DefaultAzureCredential, and a ServiceBusMessage body, optionally carrying a session_id for FIFO sessions. A receiver can run in PEEK_LOCK mode (default - locked until completed or abandoned) or RECEIVE_AND_DELETE mode (removed immediately, at-most-once delivery). Outputs: received ServiceBusMessage objects, a sequence_number from schedule_messages() used to cancel a scheduled send, and settlement outcomes via complete_message() (remove), abandon_message() (retry immediately), dead_letter_message() (move to the dead-letter queue with a reason and description), or defer_message() (set aside, retrievable by sequence number).

Integrations

Azure Service Bus (queues, topics and subscriptions, sessions, scheduled messages, dead-letter sub-queue via ServiceBusSubQueue.DEAD_LETTER) and Azure Identity (DefaultAzureCredential, sync and async variants). Bundled reference files cover messaging patterns - competing consumers, sessions, retry, request-response, transactions - and dead-letter handling and reprocessing strategies, plus a scripts/setup_servicebus.py CLI for queue, topic, and subscription management and dead-letter monitoring. The three client roles the SDK exposes - ServiceBusClient for connection management, ServiceBusSender for sending, and ServiceBusReceiver for receiving - map directly onto this pattern set.

pip install azure-servicebus azure-identity

Who it's for

Python developers building reliable messaging between services on Azure Service Bus - queue or pub/sub delivery, ordered session processing, scheduled messages, or dead-letter handling for poison messages.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.