-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 Hubs] Allow partition key use in Functions async collector #33858
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsquire
added
Event Hubs
Client
This issue points to a problem in the data-plane of the library.
Functions
labels
Feb 2, 2023
...eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Triggers/EventHubAsyncCollector.cs
Outdated
Show resolved
Hide resolved
...Jobs.Extensions.EventHubs/api/Microsoft.Azure.WebJobs.Extensions.EventHubs.netstandard2.0.cs
Outdated
Show resolved
Hide resolved
...eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Triggers/EventHubAsyncCollector.cs
Outdated
Show resolved
Hide resolved
API change check APIView has identified API level changes in this PR and created following API reviews. |
jsquire
commented
Feb 3, 2023
sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md
Outdated
Show resolved
Hide resolved
jsquire
commented
Feb 3, 2023
...b/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Config/EventHubExtensionConfigProvider.cs
Outdated
Show resolved
Hide resolved
The focus of these changes is to allow for partition keys to be used when binding to the async collector to publish events. Previously, use was restricted to the `IAsyncCollector<T>` interface, which only accepted an `EventData` instance leaving no way to specify a partition key. As a result, all events were assigned partitions via round-robin. These changes expose the `EventHubAsyncCollector` and allow binding to it, exposing an `AddAsync` overload specific to Event Hubs which accepts a partition key. This allows events to be logically grouped together, ensuring they are assigned to the same partition.
…llector<EventData> to avoid the need to introduce a new type.
…ling often lately in pipeline runs, including failing ths PR.
…ssary change in the config provider.
...Jobs.Extensions.EventHubs/api/Microsoft.Azure.WebJobs.Extensions.EventHubs.netstandard2.0.cs
Outdated
Show resolved
Hide resolved
JoshLove-msft
approved these changes
Feb 6, 2023
This was referenced Feb 6, 2023
This was referenced Feb 6, 2023
[FEATURE REQ] Azure Function EventHub allow passing of the PartitionKey in the EventData ctor
#33697
Closed
richardcho-msft
pushed a commit
to richardcho-msft/azure-sdk-for-net
that referenced
this pull request
Feb 6, 2023
…ure#33858) * [Event Hubs] Allow partition key use in async collector The focus of these changes is to allow for partition keys to be used when binding to the async collector to publish events. Previously, use was restricted to the `IAsyncCollector<T>` interface, which only accepted an `EventData` instance leaving no way to specify a partition key. As a result, all events were assigned partitions via round-robin. These changes expose the `EventHubAsyncCollector` and allow binding to it, exposing an `AddAsync` overload specific to Event Hubs which accepts a partition key. This allows events to be logically grouped together, ensuring they are assigned to the same partition.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The focus of these changes is to allow for partition keys to be used when binding to the async collector to publish events. In the original v1.x version of Functions, which used the track-zero Event Hubs library, the implementation relied on a broker-owned property of
EventData
to be set, which was possible only due to the approach used for enabling unit testing. Since the bindings moved to the track-one Event Hubs library which disallowed setting the broker-owned property, it is not been possible to use the collector with a partition key.In addition to fixing a bug with batch creation, these changes expose the
EventHubAsyncCollector
and allow binding to it, exposing anAddAsync
overload specific to Event Hubs which accepts a partition key. This enables events to be logically grouped together, ensuring they are assigned to the same partition. Previously, binding was restricted to theIAsyncCollector<T>
interface, which only accepted anEventData
instance leaving no way to specify a partition key. As a result, all events were assigned partitions via round-robin.References and Related