Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Azure Functions Extensions Bindings ServiceBus library for Python

This library allows ServiceBus Triggers in Python Function Apps to recognize and bind to client types from the Azure ServiceBus sdk.

The SDK types can be generated from:

  • ServiceBus Triggers

The supported ServiceBus SDK types include:

  • ServiceBusReceivedMessage

Source code | Package (PyPi) | Samples

Getting started

Prerequisites

Install the package

Install the Azure Functions Extensions Bindings ServiceBus library for Python with pip:

pip install azurefunctions-extensions-bindings-servicebus

Bind to the SDK-type

The Azure Functions Extensions Bindings ServiceBus library for Python allows you to create a function app with a ServiceBus Trigger and define the type as a ServiceBusReceivedMessage. Instead of receiving a ServiceBusMessage, when the function is executed, the type returned will be the defined SDK-type and have all the properties and methods available as seen in the Azure ServiceBus library for Python.

import logging
import azure.functions as func
import azurefunctions.extensions.bindings.servicebus as servicebus

app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)

@app.service_bus_queue_trigger(arg_name="receivedmessage",
                               queue_name="QUEUE_NAME",
                               connection="SERVICEBUS_CONNECTION")
def servicebus_queue_trigger(receivedmessage: servicebus.ServiceBusReceivedMessage):
    logging.info("Python ServiceBus queue trigger processed message.")
    logging.info("Receiving: %s\n"
                 "Body: %s\n"
                 "Enqueued time: %s\n"
                 "Lock Token: %s\n"
                 "Locked until : %s\n"
                 "Message ID: %s\n"
                 "Sequence number: %s\n",
                 receivedmessage,
                 receivedmessage.body,
                 receivedmessage.enqueued_time_utc,
                 receivedmessage.lock_token,
                 receivedmessage.locked_until,
                 receivedmessage.message_id,
                 receivedmessage.sequence_number)

Troubleshooting

General

The SDK-types raise exceptions defined in Azure Core.

This list can be used for reference to catch thrown exceptions. To get the specific error code of the exception, use the error_code attribute, i.e, exception.error_code.

Next steps

More sample code

Get started with our ServiceBus samples.

Several samples are available in this GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Azure ServiceBus:

  • servicebus_samples_single - Examples for using the ServiceBusReceivedMessage type:

    • From ServiceBus Queue Trigger (Single Message)
    • From ServiceBus Topic Trigger (Single Message)
  • servicebus_samples_batch - Examples for interacting with batches:

    • From ServiceBus Queue Trigger (Batch)
    • From ServiceBus Topic Trigger (Batch)

Additional documentation

For more information on the Azure ServiceBus SDK, see the Azure ServiceBus SDK documentation on Microsoft Learn and the Azure ServiceBus README.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Metadata

Release files for azurefunctions-extensions-bindings-servicebus 1.0.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azurefunctions-extensions-bindings-servicebus 1.0.0.dev1
File Size Uploaded Provenance
azurefunctions_extensions_bindings_servicebus-1.0.0.dev1.tar.gz 23.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for azurefunctions-extensions-bindings-servicebus 1.0.0.dev1
File Interpreter ABI Platform
azurefunctions_extensions_bindings_servicebus-1.0.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 44.8 kB

Release files / azurefunctions_extensions_bindings_servicebus-1.0.0.dev1.tar.gz

Download URL azurefunctions_extensions_bindings_servicebus-1.0.0.dev1.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c00bf436182033aaa5227e215072822a4ff3827bb6a7931a06ab96207294328e
BLAKE2b-256 checksum
How to use checksums
c9397023adb04f8ef14deed645dd870941d26e152518761f6fe44755de54d233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / azurefunctions_extensions_bindings_servicebus-1.0.0.dev1-py3-none-any.whl

Download URL azurefunctions_extensions_bindings_servicebus-1.0.0.dev1-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
446b9ccb7c405ef8b982edac0a6860bf4ad8de92e709b9998420517a574d7c33
BLAKE2b-256 checksum
How to use checksums
f72cf71209a67afdbef36608cb3a1879a8f4c19bf589d0a7ea5c4a24219638f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for azurefunctions-extensions-bindings-servicebus 1.0.0.dev1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page