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.Viewfor listing servicesSystem.Services.Configurefor changing trigger/configuration stateSystem.Services.Executefor 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:
AtStartIntervalScheduleEventBusOneShotFileChangedCron
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:
IEventBusfor canonical service eventsIEventRegistryfor EventBusTrigger event selection and validationIEltheonNotificationPublisherfor admin notificationsIEltheonAdminRealtimePublisherfor 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.ServiceStartedEltheon.Services.ServiceStoppedEltheon.Services.ServiceTriggeredEltheon.Services.TriggerStartedEltheon.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.