using Connected.Collections.Concurrent; namespace Connected.Notifications.Events; internal sealed class EventDispatcherJob : DispatcherJob { public EventDispatcherJob(IEventService events) { Events = events as EventService; } public EventService? Events { get; } protected override async Task OnInvoke(EventServiceArgs args, CancellationToken cancellationToken) { if (Events is null) return; /* * We have one simple taskto do: trigger event on the event service component. * Other clients are listening to that event and respond in a different way * i.e. broadcasting event to the clients */ await Events.Trigger(args); } }