fix(site-runtime): wire EventLogHandlerActor so site event log queries work

The SiteCommunicationActor expected an event log handler but none was
registered, causing "Event log handler not available" on the Event Logs
page and CLI. Bridge IEventLogQueryService to Akka via a simple actor.
This commit is contained in:
Joseph Doherty
2026-03-23 00:37:33 -04:00
parent 64c914019d
commit b3222cf30b
3 changed files with 38 additions and 0 deletions

View File

@@ -302,6 +302,16 @@ akka {{
// Register local handlers with SiteCommunicationActor // Register local handlers with SiteCommunicationActor
siteCommActor.Tell(new RegisterLocalHandler(LocalHandlerType.Artifacts, dmProxy)); siteCommActor.Tell(new RegisterLocalHandler(LocalHandlerType.Artifacts, dmProxy));
// Event log handler — bridges Akka to IEventLogQueryService
var eventLogQueryService = _serviceProvider.GetService<SiteEventLogging.IEventLogQueryService>();
if (eventLogQueryService != null)
{
var eventLogHandler = _actorSystem.ActorOf(
Props.Create(() => new SiteEventLogging.EventLogHandlerActor(eventLogQueryService)),
"event-log-handler");
siteCommActor.Tell(new RegisterLocalHandler(LocalHandlerType.EventLog, eventLogHandler));
}
// Register SiteCommunicationActor with ClusterClientReceptionist so central ClusterClients can reach it // Register SiteCommunicationActor with ClusterClientReceptionist so central ClusterClients can reach it
ClusterClientReceptionist.Get(_actorSystem).RegisterService(siteCommActor); ClusterClientReceptionist.Get(_actorSystem).RegisterService(siteCommActor);

View File

@@ -0,0 +1,27 @@
using Akka.Actor;
using Akka.Event;
using ScadaLink.Commons.Messages.RemoteQuery;
namespace ScadaLink.SiteEventLogging;
/// <summary>
/// Akka actor bridge for <see cref="IEventLogQueryService"/>.
/// Receives <see cref="EventLogQueryRequest"/> from the SiteCommunicationActor
/// and returns <see cref="EventLogQueryResponse"/>.
/// </summary>
public class EventLogHandlerActor : ReceiveActor
{
private readonly ILoggingAdapter _log = Context.GetLogger();
private readonly IEventLogQueryService _queryService;
public EventLogHandlerActor(IEventLogQueryService queryService)
{
_queryService = queryService;
Receive<EventLogQueryRequest>(msg =>
{
var response = _queryService.ExecuteQuery(msg);
Sender.Tell(response);
});
}
}

View File

@@ -8,6 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Akka" Version="1.5.62" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.5" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.5" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.5" /> <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.5" />