Repository navigation
Fixed Batch Consumer Middleware Pipeline - #9962
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes batch consumer processing so batch handlers execute through the normal consumer middleware pipeline (instead of bypassing it), and extends the runtime + tests to properly support batch-specific context/telemetry and correlation propagation.
Changes:
- Run batch handler execution through the compiled consumer pipeline using a dedicated
BatchConsumeContextand expose the compiled pipeline to derived consumers. - Add batch-aware causation propagation (
BatchId) when publishing from within a batch handler, plus inbox/outbox handling for batch deliveries. - Add integration/telemetry tests to validate batch context behavior, inbox/outbox behavior, and OpenTelemetry linking for batch consumption.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Mocha/test/Mocha.Tests/Telemetry/OpenTelemetryTests.cs | Adds batch telemetry test and transport configuration hook for in-memory endpoint setup. |
| src/Mocha/test/Mocha.Tests/Outbox/OutboxIntegrationTests.cs | Adds test ensuring batch-id is used as causation when publishing from a batch handler; adds transport configuration hook. |
| src/Mocha/test/Mocha.Tests/Inbox/InboxIntegrationTests.cs | Adds test validating inbox records each batch entry; adds transport configuration hook. |
| src/Mocha/test/Mocha.Tests/Consumers/Batching/BatchConsumerIntegrationTests.cs | Adds integration test asserting middleware pipeline sees a proper batch consume context and ambient accessor context is batch-aware. |
| src/Mocha/src/Mocha/Middlewares/DefaultMessageBus.cs | Uses BatchId as causation id when publishing/sending from within a batch consume context. |
| src/Mocha/src/Mocha/Instrumentation/ActivityMessagingDiagnosticListener.cs | Adds activity-context linking for batch consumes and batch tags; stores receive activity context in features for later linking. |
| src/Mocha/src/Mocha/Consumers/Implementations/BatchConsumer.cs | Routes batch processing through the consumer middleware pipeline using a new BatchConsumeContext and ambient accessor wiring. |
| src/Mocha/src/Mocha/Consumers/Consumer.cs | Exposes compiled consumer pipeline to derived types and allows overriding ProcessAsync. |
| src/Mocha/src/Mocha/Consumers/Batching/BatchConsumeContext.cs | Introduces batch consume context implementation used to execute batch processing through the pipeline. |
| src/Mocha/src/Mocha/Abstractions/IMessageBatch.cs | Adds non-generic IMessageBatch base interface to enable non-generic batch consume contexts. |
| src/Mocha/src/Mocha/Abstractions/Context/IBatchConsumeContext~1.cs | Adds typed batch consume context abstraction. |
| src/Mocha/src/Mocha/Abstractions/Context/IBatchConsumeContext.cs | Adds non-generic batch consume context abstraction. |
| src/Mocha/src/Mocha.Inbox/ConsumeInboxMiddleware.cs | Adds batch-aware inbox claiming/existence logic per batch entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Coverage OverviewLanguages: C# C# / code-coverage/dotnetThe overall coverage in the Show a code coverage summary of the most impacted files.
Code Coverage is in Public Preview. Learn more and provide us with your feedback. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Jun 22, 2026
This was referenced Jul 2, 2026
Closed
Closed
This was referenced Jul 26, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 15.1.14 to 16.5.1
Kuestenlogik/Bowire#506
Merged
This was referenced Aug 31, 2026
This was referenced Sep 8, 2026
This was referenced Sep 17, 2026
This was referenced Sep 28, 2026
This was referenced Oct 5, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.