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
BaseServiceextendsBackgroundServicewith start, stop, trigger, execution history, and trigger subscription behavior.IServiceManagerandServiceManagerdiscover registeredIHostedServiceimplementations that also implementIService.ServiceConfigFile<T>andServiceConfigpersist activation and trigger configuration.AtStartTrigger,IntervalTrigger, and related trigger models support recurring and startup execution.ServiceEventServiceCollectionExtensionscontributes 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.ServiceStartedEltheon.Services.ServiceStoppedEltheon.Services.ServiceTriggeredEltheon.Services.TriggerStartedEltheon.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.