elsa-core/src/modules/Elsa.Workflows.Runtime/Implementations/SynchronousTaskDispatcher.cs
Sipke Schoorstra 750c2094cc
RunTask activity (#3594)
* Implement RunTask activity
2023-01-04 20:36:38 +01:00

21 lines
818 B
C#

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