elsa-core/src/modules/Elsa.Workflows.Runtime/Services/BackgroundTaskDispatcher.cs

17 lines
644 B
C#
Raw Normal View History

using Elsa.Mediator;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Runtime.Notifications;
namespace Elsa.Workflows.Runtime.Services;
/// <summary>
/// Relies on the <see cref="INotificationSender"/> to publish the received request as a domain event from a background worker.
/// </summary>
public class BackgroundTaskDispatcher(INotificationSender notificationSender) : ITaskDispatcher
{
/// <inheritdoc />
public async Task DispatchAsync(RunTaskRequest request, CancellationToken cancellationToken = default)
{
await notificationSender.SendAsync(request, NotificationStrategy.Background, cancellationToken);
}
}