2023-07-14 17:19:41 +00:00
|
|
|
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>
|
2024-03-28 15:05:28 +00:00
|
|
|
public class BackgroundTaskDispatcher(INotificationSender notificationSender) : ITaskDispatcher
|
2023-07-14 17:19:41 +00:00
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
2024-01-05 11:13:44 +00:00
|
|
|
public async Task DispatchAsync(RunTaskRequest request, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
await notificationSender.SendAsync(request, NotificationStrategy.Background, cancellationToken);
|
|
|
|
|
}
|
2023-07-14 17:19:41 +00:00
|
|
|
}
|