feat(notification-outbox): forward site S&F notifications to central
This commit is contained in:
@@ -422,15 +422,18 @@ akka {{
|
||||
.GetRequiredService<ScadaLink.ExternalSystemGateway.DatabaseGateway>()
|
||||
.DeliverBufferedAsync(msg);
|
||||
});
|
||||
// Notification Outbox: a buffered notification is no longer delivered by
|
||||
// the site over SMTP. "Delivering" it means forwarding it to the central
|
||||
// cluster via the SiteCommunicationActor and treating central's
|
||||
// NotificationSubmitAck as the outcome (accepted → delivered; not accepted
|
||||
// or timeout → throw → transient → keep buffering). Central owns SMTP.
|
||||
var notificationForwarder = new ScadaLink.StoreAndForward.NotificationForwarder(
|
||||
siteCommActor,
|
||||
_nodeOptions.SiteId!,
|
||||
_communicationOptions.NotificationForwardTimeout);
|
||||
storeAndForwardService.RegisterDeliveryHandler(
|
||||
ScadaLink.Commons.Types.Enums.StoreAndForwardCategory.Notification,
|
||||
async msg =>
|
||||
{
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
return await scope.ServiceProvider
|
||||
.GetRequiredService<ScadaLink.NotificationService.NotificationDeliveryService>()
|
||||
.DeliverBufferedAsync(msg);
|
||||
});
|
||||
notificationForwarder.DeliverAsync);
|
||||
_logger.LogInformation(
|
||||
"Store-and-forward delivery handlers registered (ExternalSystem, CachedDbWrite, Notification)");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user