Skip to content

Parse AMQP payload for Service Bus #43979

@hallvictoria

Description

@hallvictoria

Is your feature request related to a problem? Please describe.
To support Service Bus SDK-type Bindings for Python Azure Functions, we need to parse the incoming bytes content from the Host, transform it into an AMQP message, and use that message to create a ServiceBusReceivedMessage object.

Here is an example of the incoming bytes data from the host that contains the amqp message:

amqp_message = b'\x00Sp\xc0\x0b\x05@@pH\x19\x08\x00@R\x01\x00Sq\xc1$\x02\xa3\x10x-opt-lock-token\x98\xfcS\xa1_\xddfIO\x82]\xee\x1b|4<\xfb\x00Sr\xc1U\x06\xa3\x13x-opt-enqueued-time\x83\x00\x00\x01\x8ev\xc7\xdb\xc8\xa3\x15x-opt-sequence-numberU\x0c\xa3\x12x-opt-locked-until\x83\x00\x00\x01\x8ev\xc8\xc67\x00Ss\xc0?\r\xa1 f00d2a33551440389d68e299d31adc7c@@@@@@@\x83\x00\x00\x01\x8e\xbe\xe0\xe3\xc8\x83\x00\x00\x01\x8ev\xc7\xdb\xc8@@@\x00Su\xa0\x05hello'

Describe the solution you'd like
The goal is to construct a ServiceBusReceivedMessage object out of this. azure-eventhub supports this for EventData objects via the from_bytes method created here

Describe alternatives you've considered
We previously used the uamqp library, which works out - we're able to use the Message object to create a ServiceBusReceivedMessage type with all of the expected properties and annotations populated without any additional formatting on our end. However, since the uamqp library is deprecated and no longer actively maintained (and does not support Python 3.14), we want to find an alternative solution to accomplish this.

decoded_message = uamqp.Message().decode_from_bytes(amqp_message)
return ServiceBusReceivedMessage(decoded_message, receiver=None)

Additional context
From the email thread "Azure Functions Python - alternative to uamqp library"

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.Service Buscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions