using Akka.Actor; using Akka.Event; using ZB.MOM.WW.ScadaBridge.Commons.Messages.RemoteQuery; namespace ZB.MOM.WW.ScadaBridge.SiteEventLogging; /// /// Akka actor bridge for . /// Receives from the SiteCommunicationActor /// and returns . /// public class EventLogHandlerActor : ReceiveActor { private readonly ILoggingAdapter _log = Context.GetLogger(); private readonly IEventLogQueryService _queryService; /// Initializes the actor and registers the handler. /// The query service that executes event log queries. public EventLogHandlerActor(IEventLogQueryService queryService) { _queryService = queryService; // The query is synchronous SQLite I/O (a keyword search can scan millions of // rows), so run it on the thread pool and pipe the reply back rather than pinning // an Akka dispatcher thread (review 2026-10-21 02/P1). ExecuteQuery never throws — // it returns Success:false — so no failure mapper is needed beyond the safety net. Receive(msg => { var service = _queryService; Task.Run(() => service.ExecuteQuery(msg)).PipeTo(Sender); }); } }