Repository navigation
[Mocha] Report unhealthy transports in the message bus health check and add a timeout - #10873
Merged
Merged
Conversation
This was referenced Nov 11, 2026
Contributor
Patch coverage100.0% of changed lines covered (88/88)
Project coverage: 59.9% (328252/547885 lines) |
tobias-tengler
force-pushed
the
tte/mq-05-health-check
branch
4 times, most recently
from
November 11, 2026 19:23
202b07b to
04960e7
Compare
PascalSenn
force-pushed
the
tte/mq-05-health-check
branch
2 times, most recently
from
November 13, 2026 15:21
93d0f60 to
0b66953
Compare
PascalSenn
marked this pull request as ready for review
November 13, 2026 22:08
PascalSenn
approved these changes
Nov 13, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Transports registered through the public AddTransport API lack a baseline health check, allowing a stopped receive endpoint to be ignored and the bus to report Healthy through another transport.
1 open issue
What changed in this PR
This PR makes Mocha’s ASP.NET Core health check transport-aware and adds a configurable timeout, separating message-bus readiness from process liveness.
Changes:
- Adds configurable health-check registration with a 10-second default timeout and readiness-only tagging.
- Introduces extensible bus health checks and started-state checks for the four built-in transports.
- Expands registration, timeout, cancellation, and recovery tests, with hosting and migration documentation.
| File | Description |
|---|---|
| website/content/docs/mocha/migration/migrate-from-16-7-to-16-8.md | Documents health-check behavior changes. |
| website/content/docs/mocha/hosting.md | Explains configuration and readiness/liveness separation. |
| src/Mocha/test/Mocha.Tests/Health/TransportStartedHealthCheckTests.cs | Tests transport and endpoint started-state checks. |
| src/Mocha/test/Mocha.Hosting.Tests/Health/MessageBusHealthCheckTests.cs | Tests routing, expiration, cancellation, and failure reporting. |
| src/Mocha/test/Mocha.Hosting.Tests/Health/MessageBusHealthCheckIntegrationTests.cs | Tests readiness, liveness, timeouts, and endpoint restart behavior. |
| src/Mocha/test/Mocha.Hosting.Tests/Health/MessageBusHealthCheckExtensionsTests.cs | Tests registration defaults, customization, and compatibility. |
| src/Mocha/src/Mocha/Health/TransportStartedHealthCheck.cs | Reports stopped transports and receive endpoints. |
| src/Mocha/src/Mocha/Health/MessageBusHealthFailure.cs | Represents a named health failure. |
| src/Mocha/src/Mocha/Health/MessageBusHealthContext.cs | Collects reported health failures. |
| src/Mocha/src/Mocha/Health/IMessageBusHealthCheck.cs | Defines the bus health-check contract. |
| src/Mocha/src/Mocha.Transport.RabbitMQ/MessageBusBuilderExtensions.cs | Registers RabbitMQ’s started-state check. |
| src/Mocha/src/Mocha.Transport.Postgres/MessageBusBuilderExtensions.cs | Registers Postgres’s started-state check. |
| src/Mocha/src/Mocha.Transport.InMemory/MessageBusBuilderExtensions.cs | Registers the in-memory transport’s started-state check. |
| src/Mocha/src/Mocha.Transport.AzureServiceBus/Extensions/MessageBusBuilderExtensions.cs | Registers Azure Service Bus’s started-state check. |
| src/Mocha/src/Mocha.Hosting/Health/MessageBusHealthCheckExtensions.cs | Adds registration options while retaining the existing overload. |
| src/Mocha/src/Mocha.Hosting/Health/MessageBusHealthCheck.cs | Runs registered checks before and after the health request. |
| src/Mocha/src/Mocha.Hosting/Configuration/MessageBusHealthCheckOptions.cs | Makes the endpoint option initialization-only. |
Review effort: Balanced
| : SendOptions.Default; | ||
| var failureStatus = context.Registration.FailureStatus; | ||
|
|
||
| var checks = runtime.Services.GetServices<IMessageBusHealthCheck>(); |
… timeout The message bus check no longer runs its own timer. AddMessageBus passes the timeout to the health check registration, and the check uses the registration timeout only to expire the health request. A check that times out reports the ASP.NET Core description "A timeout occurred while running check."
…checks that the transports register MessagingTransport no longer has IsHealthy and HealthFailureReason. A transport registers one or more IMessageBusHealthCheck in the services of the bus, and the message bus health check runs them. The built-in transports register TransportStartedHealthCheck, which reports a transport or a receive endpoint that is not started.
PascalSenn
force-pushed
the
tte/mq-05-health-check
branch
from
November 20, 2026 15:00
47487bc to
80d1d11
Compare
michaelstaib
added a commit
to michaelstaib/graphql-platform
that referenced
this pull request
Nov 23, 2026
* [Website] Fix HTTP response formatter docs for the v16 API (ChilliCream#10951) * Fix the release failing while installing k6 for the Fusion PGO profile (ChilliCream#10952) * Fix the AspNetCore tests failing to build for .NET 8 (ChilliCream#10962) * Rename the Draft20260903 transport version to September2026 (ChilliCream#10963) * [Fusion] Match fully reused entities on XxHash3 keys and copy producer rows once (ChilliCream#10941) * Deprecate the Draft20230127 transport version (ChilliCream#10964) * [Website] Update benchmark results (ChilliCream#10965) * Enable empty selection sets by default (ChilliCream#10971) * Add empty selection set support to StrawberryShake (ChilliCream#10972) * Persist GitHub CLI login across container rebuilds (ChilliCream#10974) * Fix the Green Donut documentation link in the README (ChilliCream#10973) * [Fusion] Fix missing operation plan metadata in YAML test snapshot diffs (ChilliCream#10975) * Use OIDC for Docker Hub login (ChilliCream#10976) * [Website] Update benchmark results (ChilliCream#10977) * Coordinate commercial builds and releases (ChilliCream#10970) * Parallelize repository preparation in prepare-release.sh (ChilliCream#10978) * Remove the cloud platform update from the release workflow (ChilliCream#10979) * [Fusion] Reduce allocations on the error path (ChilliCream#10981) * [Fusion] Fix missing errors for nested shared value types (ChilliCream#10967) Co-authored-by: tobias-tengler <45513122+tobias-tengler@users.noreply.github.com> * [Fusion] Fix null propagation for required list items (ChilliCream#10983) * [Fusion] Fix lookup error paths (ChilliCream#10986) * [Fusion] Fix missing errors for null required object list items (ChilliCream#10989) * [Fusion] Fix late subgraph results dropping siblings of nulled objects (ChilliCream#10990) * [Fusion] Fix late subgraph results reporting false list length mismatches (ChilliCream#10991) * [Fusion] Fix results with more than 32,767 source documents throwing (ChilliCream#10998) * [Website] Update npm dependencies to clear advisories (ChilliCream#11002) * Update .NET SDK to 11.0.100 (ChilliCream#11004) * [Fusion] Reduce allocations when forwarding errors (ChilliCream#11003) * [Nitro CLI] Accept Apollo persisted query manifests for client upload/validate (ChilliCream#11005) * [Mocha] Fix dispatch race during endpoint startup (ChilliCream#11006) * [Mocha] Fix ExponentialBackoff returning the same delay once it reaches the maximum (ChilliCream#10870) * [Mocha] Log receive failures and circuit breaker state changes, and fix the conversation ID of the receive span (ChilliCream#10871) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix RequestAsync waiting for a dispatch that outlasts the response timeout (ChilliCream#10872) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Report unhealthy transports in the message bus health check and add a timeout (ChilliCream#10873) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Start reply endpoints first, stop them last, and finish cleanup when a stop is cancelled (ChilliCream#10874) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix the Postgres outbox using up the attempts of a message while the transport is unavailable (ChilliCream#10875) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix scheduled messages using up their attempts while the transport is unavailable (ChilliCream#10876) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Prepare the RabbitMQ transport: internal connection types, RabbitMQ.Client 7.2.2, provisioning with the connection, queue defaults (ChilliCream#10877) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Add the RabbitMQ connection manager and failure classification (ChilliCream#10878) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix RabbitMQ consumers not attaching again after a channel or connection loss (ChilliCream#10879) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix RabbitMQ sends and publishes completing without the broker's confirmation (ChilliCream#10880) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix messages for a missing RabbitMQ queue or exchange being dropped (ChilliCream#10881) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Fix RabbitMQ requests being sent before the reply consumer is attached (ChilliCream#10882) Co-authored-by: Pascal Senn <pascal@chillicream.com> * [Mocha] Move the outbox and scheduler dispatch intervals into their options (ChilliCream#11007) * Update the .NET 11 packages to the GA release (ChilliCream#11008) * [Mocha] Fix scalar JSON bodies being cut to their last byte when a stored envelope is read (ChilliCream#11014) * [Mocha] Fix generated registrations for message types found at publish and send call sites (ChilliCream#11013) * [Mocha] Fix docs that name APIs and delivery guarantees Mocha does not have (ChilliCream#11015) * [Mocha] Add UseDispatch, UseReceive and UseConsume to the message bus host builder (ChilliCream#11020) * Update Aspire and WebUtilities to their patched releases (ChilliCream#11021) * Set a 7-day NuGet minimum publish age, exempting ChilliCream packages (ChilliCream#11023) * Replace custom test loggers and clocks with Microsoft testing utilities (ChilliCream#11025) * [Mocha] Fix saga replies being lost when the sending instance stops (ChilliCream#11022) * [Fusion] Fix PGO profile handoff to commercial builds (ChilliCream#11027) * [Fusion] Fix a source schema result staying unreleased when the result callback throws in an alias batch (ChilliCream#11009) * Fix the fixed-size array pool reserving slots for its largest level up front (ChilliCream#11011) * Skip unescaping and hashing request documents the parser has seen before (ChilliCream#11010) * Fix Postgres subscription dispose leaking a connection or hanging (ChilliCream#11026) * [Mocha] Fix saga replies being discarded when they arrive before the saga state is saved (ChilliCream#11028) * Snapshot small request feature collections without a frozen dictionary (ChilliCream#10942) * Fix the cache dropping an entry when a duplicate of its key is evicted (ChilliCream#11039) * Write the accessed flag of a cache entry only when it is not set (ChilliCream#11040) * [Fusion] Call Apollo Federation entity lookups without nested async iterators (ChilliCream#11041) * [Fusion] Read source schema results with the shape that their operation expects (ChilliCream#11043) * [Website] Add Mocha comparison pages and migration guides (ChilliCream#11024) * [Fusion] Keep the scratch state of entity lookups per request and build error variable sets on demand (ChilliCream#11042) * [Fusion] Reference the closed options services of the gateway so Native AOT binaries contain them (ChilliCream#11012) * [Fusion] Set the operation planner version to 2.13.0 * [Fusion] Update the plan snapshots of the deferred tests to the snapshot format of main * [Fusion] Fix a sibling field being lost when a late source result has errors below a nulled position --------- Co-authored-by: Glen <glen.84@gmail.com> Co-authored-by: Tobias Tengler <45513122+tobias-tengler@users.noreply.github.com> Co-authored-by: Faris Basha TM <72191505+farisbasha@users.noreply.github.com> Co-authored-by: vbornand <vbo@netswipe.ch> Co-authored-by: PascalSenn <senn.pasc@gmail.com> Co-authored-by: Pascal Senn <pascal@chillicream.com>
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.

The message bus health check only sent a health request through the bus. It had no timeout of its own, and it did not know the state of the transports.
Changes
AddMessageBus()onIHealthChecksBuildertakesname,failureStatus,tagsandtimeout. The two-parameter overload stays for binary compatibility.MessagingTransport.IsHealthyand the virtualMessagingTransport.HealthFailureReason. A transport is healthy when it is started and each of its receive endpoints is started. The check asks every transport before and after the health request and fails withTransport '<name>' is unhealthy. <reason>.Breaking changes
readyonly. It wasreadyandlive, so a liveness endpoint that filters onliveno longer runs it.AddMessageBus(tags: ["ready", "live"])keeps the old tags.Message Bus did not answer the health request within 00:00:10.andTransport '<name>' is unhealthy. <reason>.The reasons that are specific to RabbitMQ follow in #10880.
Docs:
hosting.mdand three entries in the migration guide.Part 5 of 14 of the stack that replaces #10543. It needs nothing from the parts below it and can merge to
mainon its own.