feat(consumer): expose Connected() for connection-state health checks - #29
Merged
Merged
Conversation
Add a lock-free atomic connection-state flag to Consumer and expose it via a new Connected() accessor. The flag is set true after a successful connection/reconnection and flipped false the instant the broker connection drops (before any lock is taken) and on Close. This lets callers register liveness/readiness health checks that reflect the consumer's own connection to the broker, so an orchestrator can restart a pod whose consumer has lost its connection and failed to reconnect. Reading the flag never blocks, so it is safe to poll from a health check even while the reconnection path holds the internal mutex. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
govulncheck flags GO-2026-5856 in crypto/tls@go1.26.4 (fixed in go1.26.5), which fails the CI lint job. Bump the go directive so CI builds with the fixed standard library. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Add a lock-free atomic connection-state flag to Consumer and expose it via a new Connected() accessor. The flag is set true after a successful connection/reconnection and flipped false the instant the broker connection drops (before any lock is taken) and on Close.
This lets callers register liveness/readiness health checks that reflect the consumer's own connection to the broker, so an orchestrator can restart a pod whose consumer has lost its connection and failed to reconnect. Reading the flag never blocks, so it is safe to poll from a health check even while the reconnection path holds the internal mutex.