Add IBrokerHealthProbe + RabbitMQ implementation (CritterWatch#70)#2686
Merged
jeremydmiller merged 1 commit intomainfrom May 7, 2026
Merged
Add IBrokerHealthProbe + RabbitMQ implementation (CritterWatch#70)#2686jeremydmiller merged 1 commit intomainfrom
jeremydmiller merged 1 commit intomainfrom
Conversation
Introduces a non-destructive, broker-level health probe contract that monitoring layers (e.g. CritterWatch) can use to render transport connectivity without bouncing connections. RabbitMqTransport implements the contract directly, exposing IsOpen state, recent reconnects, and TLS certificate expiry. Other broker transports (ASB / SQS / Kafka / Pulsar) are deliberate follow-ups -- this PR is RabbitMQ-only by design.
This was referenced May 7, 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.
Summary
Introduces an opt-in
IBrokerHealthProbecontract onITransportso monitoring layers (CritterWatch in particular) can render broker connectivity at a glance without bouncing connections. Ships the contract plus a RabbitMQ implementation; other transports follow in separate PRs.This pairs with CritterWatch#73's bus/listener health checks for a coherent broker-monitoring story: CritterWatch drives the existing per-listener
WolverineTransportHealthCheckfor fine-grained endpoint health, andIBrokerHealthProbefor connection-level rollup.What ships
src/Wolverine/Transports/IBrokerHealthProbe.cs—IBrokerHealthProbe,BrokerHealthSnapshotrecord,BrokerHealthStatusenum (Unknown/Healthy/Degraded/Unhealthy). Class-level XML doc spells out the non-destructive contract: probes don't reconnect or bounce; if the connection is down they returnUnhealthyrather than throw.src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqBrokerHealthProbe.cs— partial onRabbitMqTransportso the transport itself implementsIBrokerHealthProbe. InspectsIConnection.IsOpen/CloseReason, tracks reconnect counts via the existingRecoverySucceededAsyncevent inConnectionMonitor, and reads TLS cert expiry fromConnectionFactory.Ssl.CertPathwhen configured. Initial connect is recorded as a timestamp but does not bump the reconnect counter — only genuine recoveries do. A reconnect within the last two minutes flips status fromHealthytoDegraded.src/Testing/CoreTests/Transports/IBrokerHealthProbe_contract_tests.cs— sanity-checks the public surface (enum members, record value-equality, custom probe implementation).src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/RabbitMqBrokerHealthProbe_tests.cs— boots a Wolverine host withUseRabbitMq().AutoProvision(), asserts the transport is discoverable viaruntime.Options.Transports.OfType<IBrokerHealthProbe>(), probes forHealthy, then closes both connections externally and probes again forUnhealthy.docs/guide/messaging/transports/broker-health-probes.md— new docs page describing the contract, discovery pattern, status semantics, and per-transport support; linked from the RabbitMQ index page.Deliberate scope cut
Azure Service Bus, Amazon SQS/SNS, Kafka, and Pulsar are not in this PR. They'll pattern-match the RabbitMQ implementation as their underlying client SDKs are surveyed; doing them all here would bloat the diff without changing the shape of the contract. The docs page lists them as
Pending.Test coverage
dotnet test src/Testing/CoreTests/CoreTests.csproj --filter IBrokerHealthProbe_contract_tests— 3 tests passing on net9.0.dotnet test src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests --filter RabbitMqBrokerHealthProbe_tests— 3 tests passing locally on net9.0 againstrabbitmq:4-management. Marked[Trait("Category", "Flaky")]to follow the project convention for tests that hit the broker.Test plan
dotnet buildagainstWolverine,Wolverine.RabbitMQ,Wolverine.RabbitMQ.Tests,CoreTests— 0 errors.🤖 Generated with Claude Code