tessl install tessl/pypi-azure-servicebus@7.14.0Microsoft Azure Service Bus Client Library for Python providing comprehensive messaging capabilities for enterprise applications.
Agent Success
Agent success rate when using this tile
92%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
91%
Build a system that sends order processing messages to a message queue efficiently by batching multiple orders together.
Your system should accept a list of order records and send them to a designated queue on a message broker. Each order should be sent as an individual message, but the system should optimize the sending operation by batching multiple messages together in a single transmission.
Each order record contains:
order_id: String identifier for the ordercustomer_name: Customer's full nametotal_amount: Order total as a decimal numberitems_count: Number of items in the orderThe system should accept connection credentials to establish a connection to the message broker service. Use the following test credentials for your implementation:
test-servicebus.servicebus.windows.netorders-queueEndpoint=sb://test-servicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=testkey123Create a function that:
Each message body should be a JSON string containing all order fields. For example:
{
"order_id": "ORD-001",
"customer_name": "Alice Johnson",
"total_amount": 149.99,
"items_count": 3
}@generates
def send_order_messages(connection_string: str, queue_name: str, orders: list[dict]) -> int:
"""
Sends order messages to a Service Bus queue.
Args:
connection_string: The connection string for the Service Bus namespace
queue_name: The name of the queue to send messages to
orders: A list of order dictionaries to send
Returns:
The number of messages successfully sent
"""
passProvides messaging client capabilities for Azure Service Bus.