NuGet ยท nuget

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Events

Core EventBus feature for Eltheon Framework

Install

Install-Kommandos

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

README

Vorschau

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Events

In-process EventBus for Eltheon v2. Ships the core contracts (IEvent, IEventBus, IEventProvider, IEventTransport), a default in-process bus, bounded in-memory transport, and an event registry. Goal: publish business events consistently and decouple features (Notifications, SignalR, Logging).

Scope: In-process only. External brokers/webhooks belong in follow-up features.

Install

dotnet add package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Events

DI-Setup

builder.Services.AddEltheonEvents(
    bus => {
        bus.DispatchMode = EventDispatchMode.Sequential; // oder Parallel
        bus.ErrorMode = EventErrorMode.ContinueOnError;  // oder StopOnFirstError
    },
    transport => {
        transport.Capacity = 1_000;
        transport.FullBehavior = TransportFullBehavior.DropOnFull; // ThrowOnFull / WaitWithTimeout
    });

Publish & Subscribe

public sealed record UserCreatedEvent(string UserId, string Email) : IEvent
{
    public string EventName => "User.Created";
    public DateTime OccurredAtUtc { get; } = DateTime.UtcNow;
    public string? Source => "Identity";
    public string? CorrelationId { get; init; }
    public string? Category => "UserLifecycle";
}

public sealed class NotificationEventProvider : IEventProvider
{
    public Task HandleAsync(IEvent @event, CancellationToken ct = default)
    {
        if (@event.EventName == "User.Created")
        {
            // Notification erzeugen ...
        }
        return Task.CompletedTask;
    }
}

// Usage in feature code
await _eventBus.PublishAsync(new UserCreatedEvent(user.Id, user.Email));

Transport & Registry

  • Transport: InMemoryEventTransport is bounded; behavior on full buffer is configurable (Drop/Throw/Wait). Suitable for later background services.
  • Registry: InMemoryEventRegistry stores metadata (EventMetadata) and can feed logging/metrics. Seed via IEventRegistry.Register(...) or DI.
  • Metrics: If the Metrik feature is registered, published events increment eltheon_events_publish_total{event,category,severity,success,providers}.

Tests

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Events.Test covers dispatch error paths (Continue/Stop) and transport enqueue/dequeue. Add further tests for cancellation/timeouts as needed.