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.6.7
<PackageReference Include="Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Service" Version="0.9.6.7" />
paket add Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Service --version 0.9.6.7
Install-Package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Service -Version 0.9.6.7

README

Vorschau

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

Feature-owned service management for Eltheon. The package owns the Services admin RCL, API endpoints, typed permissions, navigation contribution, service runtime, trigger configuration, optional service events, optional admin notifications, and optional realtime refreshes.

The package is independently upgradeable. Cross-feature integration uses neutral contracts from Core.Abstractions; the package does not require concrete Events, Notifications, or SignalR feature implementations.

Setup

builder.Services.AddEltheonServices();

builder.Services.AddRazorPages()
    .AddEltheonServicesApplicationPart();

Register concrete services through normal hosting registration:

builder.Services.AddHostedService<MyService>();

During host startup, call IServiceManager.InitializeAsync() after hosted services are registered.

Admin Surface

The RCL contributes:

  • /Admin/Services/Index
  • /Admin/Services/ServiceConfiguration/{ServiceName}
  • /api/v1/admin/services
  • /api/v1/admin/services/{id}
  • /api/v1/admin/services/{id}/start
  • /api/v1/admin/services/{id}/stop
  • /api/v1/admin/services/{id}/trigger

The package registers typed permissions:

  • System.Services.View for listing services
  • System.Services.Configure for changing trigger/configuration state
  • System.Services.Execute for start, stop, and trigger actions

ServiceManagement can remain in host seeds as a legacy permission, but it is not used by the feature-owned pages, API, or navigation.

Service Models

Legacy services can implement IService directly or inherit from BaseService. Newer feature packages can expose IEltheonManagedService from Core.Abstractions; the Service package adapts those services so they remain visible, configurable, and triggerable in the admin UI without creating feature-to-feature dependencies.

public sealed class CleanupService : BaseService
{
    public override string ServiceName => "CleanupService";

    public override Task StartAsync() => Task.CompletedTask;
    public override Task StopAsync() => Task.CompletedTask;

    public override Task TriggerAsync()
    {
        return Task.CompletedTask;
    }

    public override void Configure(dynamic configuration)
    {
    }

    protected override Task ExecuteAsync(CancellationToken stoppingToken)
    {
        return Task.CompletedTask;
    }
}

Triggers

Built-in triggers:

  • AtStart
  • Interval
  • Schedule
  • EventBus
  • OneShot
  • FileChanged
  • Cron

Triggers are registered through IServiceTriggerRegistry and persisted with a stable TriggerType discriminator. Existing legacy config files that contain Newtonsoft $type metadata are still readable, but new writes no longer emit $type.

EventBusTrigger can use registered event metadata from IEventRegistry. The admin UI renders known events as a selection list, filters service-internal events by default, and server-side save logic ignores unknown or unsafe values. If unsupported values are discarded and a notification publisher is available, an admin warning is published in the service alert category.

FileChangedTrigger watches existing local directories only and debounces file-system event bursts. CronTrigger uses Cronos to calculate the next occurrence and supports time zones plus optional seconds. Invalid watcher paths or cron expressions are ignored defensively and reported through admin notifications when saved from the UI.

Optional Integrations

If present, these neutral ports are used:

  • IEventBus for canonical service events
  • IEventRegistry for EventBusTrigger event selection and validation
  • IEltheonNotificationPublisher for admin notifications
  • IEltheonAdminRealtimePublisher for Services UI refresh events

When a port is absent, the feature continues to work and skips that optional side effect.

Events

The manager publishes canonical volatile events when IEventBus is available:

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

Legacy Service.* events are disabled by default and can be enabled only for compatibility:

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

Packaging Notes

This is a Razor Class Library. Hosts consuming it through NuGet must call both AddEltheonServices() and AddEltheonServicesApplicationPart(). The package carries its own _ViewImports.cshtml so Core.WebUi and Bootstrap tag helpers work after pack/install.