Microsoft Azure Service Bus Client Library for Python providing comprehensive messaging capabilities for enterprise applications.
Overall
score
92%
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.
Install with Tessl CLI
npx tessl i tessl/pypi-azure-servicebusdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10