feat: self-heal backplane subscriptions after a cluster reconnect#171
Open
d-barker wants to merge 1 commit into
Open
feat: self-heal backplane subscriptions after a cluster reconnect#171d-barker wants to merge 1 commit into
d-barker wants to merge 1 commit into
Conversation
When the Orleans cluster connection drops and later recovers, the SignalR backplane's implicit stream subscriptions are not automatically restored, so servers can stop receiving messages until they are restarted. This adds an opt-in OrleansSignalRConnectionMonitor that observes cluster connection lifecycle events and re-establishes the backplane subscriptions on reconnect, with a configurable retry/back-off policy. - OrleansSignalRConnectionMonitor + OrleansSignalRConnectionMonitorOptions: retry count, delay, and an optional InnerRetryFilter to compose with an existing client retry policy. - AddSignalRBackplaneSelfHealing() client-builder extension to register it. - OrleansHubLifetimeManager wires in the re-subscription path. - Unit tests covering retry attempts, exhaustion, and inner-filter composition. Co-Authored-By: Claude Opus 4.8 <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.
Summary
Adds an opt-in mechanism to automatically restore the SignalR backplane's stream subscriptions after the Orleans cluster connection drops and recovers.
Problem
When the Orleans client loses its connection to the cluster and later reconnects (for example, a full cluster recycle such as scaling the silo from one replica to many), the backplane's implicit stream subscriptions are not re-established. The client reconnects to a new cluster generation, but the hub server's in-memory
SERVER_STREAM/ALL_STREAMobservers are orphaned — so affected servers silently stop receiving backplane messages until the hub server process is restarted.Change
OrleansSignalRConnectionMonitor— anIClientConnectionRetryFilterthat doubles as a connection-loss signal. On every failed connection attempt it raisesConnectionLost;OrleansHubLifetimeManagersubscribes and re-establishes its stream subscriptions as soon as the cluster is reachable again.OrleansSignalRConnectionMonitorOptions— configurableMaxRetryAttempts(0 = retry indefinitely, the default),RetryDelay(default 5s), and an optionalInnerRetryFilterto compose with an existing client retry/back-off policy.AddSignalRBackplaneSelfHealing()— client-builder extension to register the monitor.OrleansHubLifetimeManager— wires in the re-subscription path.Client usage
Opt in on the Orleans client (the hub server's client builder), alongside the existing
UseSignalR()call:Tune the retry policy via options:
Compose with an application's existing
IClientConnectionRetryFilter— the monitor still emits the reconnect signal, but defers the keep-retrying decision (and its back-off) to your filter:Notes
AddSignalRBackplaneSelfHealing()is called.🤖 Generated with Claude Code