NuGet ยท nuget

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Service

Core Feature for Services for Eltheon Framework

Install

Install-Kommandos

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

README

Vorschau

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Service

Background service management feature for Eltheon. It wraps ASP.NET Core hosted services with lifecycle control, trigger configuration, execution history, optional event publishing, optional notifications, and optional admin realtime updates.

The package is now transport-neutral. It no longer references Notifications, SignalR, or the concrete Events implementation. Cross-feature integration happens through Core.Abstractions ports.

Install

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

Feature Set

  • BaseService extends BackgroundService with start, stop, trigger, execution history, and trigger subscription behavior.
  • IServiceManager and ServiceManager discover registered IHostedService implementations that also implement IService.
  • ServiceConfigFile<T> and ServiceConfig persist activation and trigger configuration.
  • AtStartTrigger, IntervalTrigger, and related trigger models support recurring and startup execution.
  • ServiceEventServiceCollectionExtensions contributes service event metadata without registering a concrete EventBus.

DI Setup

builder.Services.AddEltheonServiceEvents();
builder.Services.AddSingleton<IServiceManager, ServiceManager>();
builder.Services.AddHostedService<MyCustomService>();

Optional integrations:

builder.Services.AddEltheonEvents();                       // provides IEventBus
builder.Services.AddEltheonNotifications();                // provides IEltheonNotificationPublisher
builder.Services.AddSignalRAdminRealtimePublisher();       // provides IEltheonAdminRealtimePublisher

The Service feature does not require those packages. If the ports are absent, service management still works and simply skips the optional side effect.

Implementing a Service

public sealed class CleanupService : BaseService
{
    protected override Task ExecuteAsync(CancellationToken stoppingToken)
    {
        return Task.CompletedTask;
    }

    public override Task TriggerAsync()
    {
        // Run cleanup work.
        return Task.CompletedTask;
    }
}

Register the service with DI:

builder.Services.AddHostedService<CleanupService>();

Call IServiceManager.InitializeAsync() during host startup after hosted services are registered.

Events

When IEventBus is present and events are enabled, ServiceManager publishes canonical service events:

  • Eltheon.Services.ServiceStarted
  • Eltheon.Services.ServiceStopped
  • Eltheon.Services.ServiceTriggered
  • Eltheon.Services.TriggerStarted
  • Eltheon.Services.TriggerFinished

Legacy Service.* events remain available for compatibility but are not published by default. Enable them only for hosts that still have legacy consumers:

builder.Services.Configure<ServiceEventOptions>(options =>
{
    options.PublishLegacyEvents = true;
});

Notifications and Realtime

ServiceManager can publish operational notifications through IEltheonNotificationPublisher and admin UI refreshes through IEltheonAdminRealtimePublisher.

This keeps Service independently upgradeable:

  • Service knows the neutral ports.
  • Notifications implements notification publishing.
  • SignalR implements realtime transport.
  • The host composes the pieces.

Diagnostics

Every service exposes status, execution history, and last execution through IService. The manager publishes updates after start, stop, trigger, trigger-start, and trigger-finish operations when the optional realtime port is available.