Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 2.74 KB

File metadata and controls

59 lines (43 loc) · 2.74 KB

Feature: Hub lifetime manager integration

Summary

The ASP.NET Core host swaps the default SignalR hub lifetime manager with OrleansHubLifetimeManager<THub> so all hub operations route through Orleans grains.

Scope

In scope

  • Hub lifetime manager registration via DI (AddOrleans).
  • Connection lifecycle and message routing through Orleans grains.

Out of scope

  • Partitioning strategy details (see Connection/Group partitioning docs).
  • Observer health and circuit breaker behavior.

Implementation plan (step-by-step)

  • Restore fire-and-forget fan-out for multi-group and multi-user sends.
  • Ensure per-target send failures are logged without blocking hub execution.
  • Route package-specific batch group membership calls through the Orleans lifetime manager.
  • Keep batch group helper calls usable when the host is running plain AddSignalR().
  • Add regression coverage for the batch helper path without Orleans registration.
  • Re-run batch partition cleanup after disconnect when a late coordinator write finishes.

Main flow

flowchart TD
  Host["ASP.NET Core host"]
  Hub["SignalR hub"]
  Batch["Batch group helper"]
  Manager["OrleansHubLifetimeManager"]
  Grains["SignalR grains"]

  Host --> Hub --> Batch --> Manager --> Grains
Loading

Behavior notes

  • AddOrleans() registers OrleansHubLifetimeManager<THub> as the HubLifetimeManager implementation.
  • The lifetime manager creates a per-connection Subscription and registers observers with connection/group/user grains.
  • Package-specific batch group operations (AddToGroupsAsync / RemoveFromGroupsAsync) also route through the lifetime manager instead of looping over sequential single-group writes.
  • Hub batch helpers fall back to the registered HubLifetimeManager<THub> when IOrleansGroupManager<THub> is not explicitly registered, so the API still works on plain AddSignalR() hosts.
  • If a partitioned batch join finishes after the connection has already disconnected, the lifetime manager immediately routes a compensating batch remove through the coordinator before returning.
  • Detailed batching behavior and partition persistence rules live in docs/Features/Group-Partitioning.md.

Configuration knobs

  • OrleansSignalROptions (registered by the client extension)
  • HubOptions and HubOptions<THub> (SignalR host configuration)

Key types and files

  • ManagedCode.Orleans.SignalR.Client/Extensions/OrleansDependencyInjectionExtensions.cs
  • ManagedCode.Orleans.SignalR.Client/Extensions/OrleansHubGroupExtensions.cs
  • ManagedCode.Orleans.SignalR.Core/HubContext/IOrleansGroupManager.cs
  • ManagedCode.Orleans.SignalR.Core/SignalR/OrleansHubLifetimeManager.cs
  • ManagedCode.Orleans.SignalR.Core/SignalR/Observers/Subscription.cs