You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Notifications/Events/EventDispatcherJob.cs

26 lines
680 B

2 years ago
using Connected.Collections.Concurrent;
namespace Connected.Notifications.Events;
internal sealed class EventDispatcherJob : DispatcherJob<EventServiceArgs>
{
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);
}
}