[Event Hubs] Buffered Producer Await Handlers #27173
Merged
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 shift the invocation of event handlers for the
EventHubBufferedProducerClient
from a non-deterministic background approach to one that is deterministic and in consistent order.Feedback from beta customers has indicated that the "random" nature of handler invocations made it difficult to "checkpoint" with the source of events to mark them as complete. Handlers were potentially invoked in a different order than the batches were sent, and the handler was unable to pause publishing for a partition to accommodate completing a "checkpoint" operation.
Originally, the goal for background invocation was to ensure that handlers which were long-running or performed a heavy workload could not impact publishing throughput, but this also created additional pressure on the thread pool due to the unconstrained use of
Task.Run
to ensure that handlers written with synchronous code did not execute synchronously.