Parse AMQP Payload from EventHub Properly #39711
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Event Hubs
feature-request
This issue requires a new behavior in the product in order be resolved.
Messaging
Messaging crew
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
Is your feature request related to a problem? Please describe.
To support EventHub SDK-type Bindings for the Python worker, we need to parse the incoming content (from ModelBindingData) that the Functions Host sends us. Here is an example:
Raw data:
"\000Sr\301\207\010\243\033x-opt-sequence-number-epochT\377\243\025x-opt-sequence-numberU\000\243\014x-opt-offsetU\000\243\023x-opt-enqueued-time\000\243\035com.microsoft:datetime-offset\201\010\335F\333\247\202\022 \000St\301I\002\241\rDiagnostic-Id\241700-1aa201483d464ac3c3d2ab796fbccb36-72e947bb22f404fc-00\000Su\240\010message1"
The representation of this in code (from the debugger):
b'\x00Sr\xc1\x87\x08\xa3\x1bx-opt-sequence-number-epochT\xff\xa3\x15x-opt-sequence-numberU\x00\xa3\x0cx-opt-offsetU\x00\xa3\x13x-opt-enqueued-time\x00\xa3\x1dcom.microsoft:datetime-offset\x81\x08\xddF\xdb\xa7\x82\x12 \x00St\xc1I\x02\xa1\rDiagnostic-Id\xa1700-1aa201483d464ac3c3d2ab796fbccb36-72e947bb22f404fc-00\x00Su\xa0\x08message1'
Describe the solution you'd like
The goal is to be able to construct an azure.eventhub.EventData object out of this. Today, the Dotnet worker does exactly this by parsing using the Azure.Core.Amqp library (FromBytes).
Is there a proper way to parse this data in Python, like how the Dotnet worker does it? That is, there should be a FromBytes method that will easily convert this data into an EventHub object.
Describe alternatives you've considered
We have tried using similar libraries in Python such as azure.eventhub.amqp and uamqp but are met with decoding errors or an invalid/empty EventData object.
Additional context
From thread "Azure Functions Python - Parsing EventHub Message"
The text was updated successfully, but these errors were encountered: