< Summary

Information
Class: Elsa.Mediator.PublishingStrategies.BackgroundProcessingStrategy
Assembly: Elsa.Mediator
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/PublishingStrategies/BackgroundProcessingStrategy.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 26
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
PublishAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/PublishingStrategies/BackgroundProcessingStrategy.cs

#LineLine coverage
 1using Elsa.Mediator.Contexts;
 2using Elsa.Mediator.Contracts;
 3using Elsa.Mediator.Middleware.Notification;
 4using Microsoft.Extensions.DependencyInjection;
 5
 6namespace Elsa.Mediator.PublishingStrategies;
 7
 8/// <summary>
 9/// Invokes event handlers in parallel and does not wait for the result.
 10/// </summary>
 11public class BackgroundProcessingStrategy : IEventPublishingStrategy
 12{
 13    /// <inheritdoc />
 14    public async Task PublishAsync(NotificationStrategyContext context)
 15    {
 116        var notificationsChannel = context.ServiceProvider.GetRequiredService<INotificationsChannel>();
 117        var notificationContext = context.NotificationContext;
 118        var queuedContext = new NotificationContext(
 119            notificationContext.Notification,
 120            NotificationStrategy.Sequential,
 121            notificationContext.ServiceProvider,
 122            notificationContext.CancellationToken);
 23
 124        await notificationsChannel.Writer.WriteAsync(queuedContext, context.CancellationToken);
 125    }
 26}

Methods/Properties

PublishAsync()