NuGet · nuget

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications

Provides a generic notification bus for Eltheon hosts and plugins.

Install

Install-Kommandos

dotnet add package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications --version 0.9.1.1
<PackageReference Include="Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications" Version="0.9.1.1" />
paket add Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications --version 0.9.1.1
Install-Package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications -Version 0.9.1.1

README

Vorschau

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, and NotificationCategoryKeys define the shared payload contract. Every notification carries a category key so hosts can segment routing, filtering, or per-role opt-in logic.
  • INotificationPublisher offers a DI friendly abstraction for emitting messages.
  • NotificationBus fan-outs each published message to every registered INotificationSink.
  • NotificationSignalRDispatcher implements a sink that pushes notifications into the Admin/User/Public hubs via ReceiveNotification.
  • AddEltheonNotifications() registers the bus, while AddNotificationSignalRBridge() wires up the SignalR sink.
  • When Features.Metrik is 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; success is true/false.