feat(notification-outbox): register NotificationOutbox singleton in Host
Wire the Notification Outbox into the Host central role: - Program.cs: call AddNotificationOutbox() on the central path (binds NotificationOutboxOptions via BindConfiguration; no explicit Configure). - AkkaHostedService.RegisterCentralActors(): create the NotificationOutboxActor as a non-role-scoped central cluster singleton + proxy, then send RegisterNotificationOutbox(proxy) to the CentralCommunicationActor. - appsettings.Central.json: add the ScadaLink:NotificationOutbox section with the NotificationOutboxOptions defaults. - SiteServiceRegistration: remove the now-dead AddNotificationService() call - sites forward notifications to central rather than delivering over SMTP, and no site component consumes the SMTP machinery. - Host.csproj: add the ScadaLink.NotificationOutbox project reference. - Tests: add central outbox singleton/proxy actor-path assertions, drop the site OAuth2TokenService/INotificationDeliveryService resolution assertions, and add NotificationOutbox to the component-library IConfiguration check.
This commit is contained in:
@@ -260,6 +260,36 @@ akka {{
|
||||
mgmtHolder.ActorRef = mgmtActor;
|
||||
_logger.LogInformation("ManagementActor registered with ClusterClientReceptionist");
|
||||
|
||||
// Notification Outbox — cluster singleton so exactly one node owns ingest,
|
||||
// the dispatch sweep and the purge loop. Central actors run on the base
|
||||
// "Central" role, so the singleton settings are NOT role-scoped (unlike the
|
||||
// site singletons, which are scoped to a per-site role).
|
||||
var outboxOptions = _serviceProvider
|
||||
.GetRequiredService<IOptions<ScadaLink.NotificationOutbox.NotificationOutboxOptions>>().Value;
|
||||
var outboxLogger = _serviceProvider.GetRequiredService<ILoggerFactory>()
|
||||
.CreateLogger<ScadaLink.NotificationOutbox.NotificationOutboxActor>();
|
||||
|
||||
var outboxSingletonProps = ClusterSingletonManager.Props(
|
||||
singletonProps: Props.Create(() => new ScadaLink.NotificationOutbox.NotificationOutboxActor(
|
||||
_serviceProvider,
|
||||
outboxOptions,
|
||||
outboxLogger)),
|
||||
terminationMessage: PoisonPill.Instance,
|
||||
settings: ClusterSingletonManagerSettings.Create(_actorSystem!)
|
||||
.WithSingletonName("notification-outbox"));
|
||||
_actorSystem!.ActorOf(outboxSingletonProps, "notification-outbox-singleton");
|
||||
|
||||
var outboxProxyProps = ClusterSingletonProxy.Props(
|
||||
singletonManagerPath: "/user/notification-outbox-singleton",
|
||||
settings: ClusterSingletonProxySettings.Create(_actorSystem)
|
||||
.WithSingletonName("notification-outbox"));
|
||||
var outboxProxy = _actorSystem.ActorOf(outboxProxyProps, "notification-outbox-proxy");
|
||||
|
||||
// Hand the outbox proxy to the CentralCommunicationActor so forwarded
|
||||
// NotificationSubmit messages from sites are routed to the outbox singleton.
|
||||
centralCommActor.Tell(new RegisterNotificationOutbox(outboxProxy));
|
||||
_logger.LogInformation("NotificationOutbox singleton created and registered with CentralCommunicationActor");
|
||||
|
||||
_logger.LogInformation("Central actors registered. CentralCommunicationActor created.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user