using Elsa.Mediator.Contracts;
using Elsa.Workflows.Runtime.Notifications;
namespace Elsa.Workflows.Runtime;
///
/// Relies on the to synchronously publish the received request as a domain event.
///
public class SynchronousTaskDispatcher : ITaskDispatcher
{
private readonly INotificationSender _notificationSender;
///
/// Constructor.
///
public SynchronousTaskDispatcher(INotificationSender notificationSender) => _notificationSender = notificationSender;
///
public async Task DispatchAsync(RunTaskRequest request, CancellationToken cancellationToken = default) => await _notificationSender.SendAsync(request, cancellationToken);
}