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