Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications
Overview
This feature packages a lightweight notification bus that allows Eltheon hosts, templates, and plugins to publish operational events without coupling to specific UI implementations. Notifications can be routed to any number of sinks; the default sink provided by the package forwards messages to the existing Admin/User/Public SignalR hubs so web clients receive them instantly.
Building Blocks
NotificationMessage,NotificationScope,NotificationSeverity, andNotificationCategoryKeysdefine the shared payload contract. Every notification carries a category key so hosts can segment routing, filtering, or per-role opt-in logic.INotificationPublisheroffers a DI friendly abstraction for emitting messages.NotificationBusfan-outs each published message to every registeredINotificationSink.NotificationSignalRDispatcherimplements a sink that pushes notifications into the Admin/User/Public hubs viaReceiveNotification.AddEltheonNotifications()registers the bus, whileAddNotificationSignalRBridge()wires up the SignalR sink.- When
Features.Metrikis present, publish attempts are counted per sink/scope/severity (eltheon_notifications_publish_total{sink,scope,severity,success}).
Usage
builder.Services
.AddEltheonNotifications()
.AddNotificationSignalRBridge();
public class ExampleService
{
private readonly INotificationPublisher _publisher;
public ExampleService(INotificationPublisher publisher) => _publisher = publisher;
public Task NotifyAsync() =>
_publisher.PublishAsync(NotificationMessage.Create(
title: "Deployment",
message: "A new build is live.",
scope: NotificationScope.Admin | NotificationScope.User,
severity: NotificationSeverity.Success,
category: NotificationCategoryKeys.General));
}
On the client side, listen to the ReceiveNotification SignalR event (or the eltheon:notification DOM event used by the template) and render toast/snackbar components as needed.
Notes
- The bus is synchronous per sink but awaits asynchronous work inside each sink.
- Register your own sinks (e.g., persistence, queueing, external webhooks) by implementing
INotificationSink. - If you target a host that hasn’t updated to the latest package, you can still add a category via
Metadata["category"]; the template’s persistence sink inspects both the strongly typed property and metadata to keep storage backward compatible. - The SignalR sink depends on the SignalR feature package being added to the host. The extension does not register hubs automatically.
Metrics
When the Metrik feature is registered, publish attempts are counted:
eltheon_notifications_publish_total{sink,scope,severity,success}– per-sink fan-out attempts, labeled by scope (Admin/User/Public) and severity;successistrue/false.