-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event metadata can get out-of-sync when using this sample code for event hubs trigger #876
Comments
@mattchenderson for awareness @wesselkranenborg we'll update the sample to make sure others are not impacted by this, but will also be following up on the Event Hubs trigger implementation. Can you please share the version of the extension you are referencing? Thanks! |
Assigning this to 123 to update the sample while we investigate the issue with the trigger |
Hi @fabiocav I'm a colleague of @wesselkranenborg. Know the issue at hand pretty well, I can also answer the question about the used packages and their version:
|
@fabiocav I was a few days on leave but my colleague already responded. Am curious about the issue with the trigger. Do you have an issue Id from that or is that tracked with this issue? Thanks @Privarozenbeek. |
Thank you @wesselkranenborg @Privarozenbeek Update from the investigation so far:
I will follow up with the team to discuss the right fix & impact of it and share an update as we make progress. |
Initial investigation is done and root cause identified. The fix requires a change in the host. The below issue will track the progress of that. |
We published the worker package 1.11.0-preview2 which has a fix for this. https://github.com/Azure/azure-functions-dotnet-worker/releases/tag/1.11.0-preview2 Currently you need to to explicitly opt-in to this behavior while bootstrapping the application like below sample.
We plan on enabling this by default in the next major version update of worker package. The host level fix is on v4.12.2. Waiting for the core tools release which reflects this change. Hopefully this will be out in the next week or so. |
In this repository there are some samples on how to fetch metadata from messages: https://github.com/Azure/azure-functions-dotnet-worker/blob/main/samples/Extensions/EventHubs/EventHubsTriggerMetadata.cs.
The code referring too is this:
This code can however create bugs in software. If you have a message without a body there is no corresponding item in the
string[] messages
array but there are properties in theDictionary<string, JsonElement>[] propertiesArray
. If you parse these in batch the indexes between the different arrays are not equals which leads to wrong properties being used with wrong messages.Let's take this example:
We have two messages coming in with the same batch. One (1) with a property but without body (yes, we have those) and another (2) where the body is filled. These are coming in, in the following way:
messages = int[1]{ messageBodyFrom2 }
propertiesArray = int [2] { propertiesFrom1, propertiesFrom2 }
How can we correlate the correct properties to the messagebody?
Is it not better that all arrays are always having the equal size? Something like this:
messages = int[2]{ nullValueAsMessageBodyFrom1, messageBodyFrom2 }
propertiesArray = int [2] { propertiesFrom1, propertiesFrom2 }
The text was updated successfully, but these errors were encountered: