elsa-core/src/modules/Elsa.Workflows.Runtime/Services/SynchronousTaskDispatcher.cs
gurkanguran c11aa6cf5f
Implemented workflow validation for httpendpoint path (#4181)
* Validates HttpEndpoint path before publishing workflow

* Updated behaviour of mediator apis and implemented validation for workflow path

* Implement default strategy option

* Update mediator service names

* Return validation errors as 400 BadRequest

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2023-07-14 19:19:41 +02:00

22 lines
831 B
C#

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