< Summary

Line coverage
40%
Covered lines: 10
Uncovered lines: 15
Coverable lines: 25
Total lines: 68
Line coverage: 40%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2
 3namespace Elsa.Workflows.Runtime.Distributed;
 4
 5/// <summary>
 6/// Represents a distributed workflow runtime that can create <see cref="IWorkflowClient"/> instances connected to a wor
 7/// </summary>
 8public partial class DistributedWorkflowRuntime : IWorkflowRuntime
 9{
 10    private readonly IServiceProvider _serviceProvider;
 11    private readonly IIdentityGenerator _identityGenerator;
 12
 13    /// <summary>
 14    /// Represents a distributed workflow runtime that can create <see cref="IWorkflowClient"/> instances connected to a
 15    /// </summary>
 13316    public DistributedWorkflowRuntime(IServiceProvider serviceProvider, IIdentityGenerator identityGenerator)
 17    {
 13318        _serviceProvider = serviceProvider;
 13319        _identityGenerator = identityGenerator;
 13320        _obsoleteApi = new(() => ObsoleteWorkflowRuntime.Create(serviceProvider, CreateClientAsync));
 13321    }
 22
 23    /// <inheritdoc />
 24    public async ValueTask<IWorkflowClient> CreateClientAsync(CancellationToken cancellationToken = default)
 25    {
 3326        return await CreateClientAsync(null, cancellationToken);
 3327    }
 28
 29    /// <inheritdoc />
 30    public ValueTask<IWorkflowClient> CreateClientAsync(string? workflowInstanceId, CancellationToken cancellationToken 
 31    {
 12232        workflowInstanceId ??= _identityGenerator.GenerateId();
 12233        var client = (IWorkflowClient)ActivatorUtilities.CreateInstance(_serviceProvider, typeof(DistributedWorkflowClie
 12234        return new(client);
 35    }
 36}

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs

#LineLine coverage
 1using Elsa.Workflows.Runtime.Entities;
 2using Elsa.Workflows.Runtime.Filters;
 3using Elsa.Workflows.Runtime.Matches;
 4using Elsa.Workflows.Runtime.Options;
 5using Elsa.Workflows.Runtime.Parameters;
 6using Elsa.Workflows.Runtime.Params;
 7using Elsa.Workflows.Runtime.Requests;
 8using Elsa.Workflows.Runtime.Results;
 9using Elsa.Workflows.State;
 10
 11namespace Elsa.Workflows.Runtime.Distributed;
 12
 13public partial class DistributedWorkflowRuntime
 14{
 15    private readonly Lazy<ObsoleteWorkflowRuntime> _obsoleteApi;
 016    private ObsoleteWorkflowRuntime ObsoleteApi => _obsoleteApi.Value;
 17
 018    public Task<CanStartWorkflowResult> CanStartWorkflowAsync(string definitionId, StartWorkflowRuntimeParams? options =
 019    public Task<WorkflowExecutionResult> StartWorkflowAsync(string definitionId, StartWorkflowRuntimeParams? options = n
 020    public Task<ICollection<WorkflowExecutionResult>> StartWorkflowsAsync(string activityTypeName, object bookmarkPayloa
 021    public Task<WorkflowExecutionResult?> TryStartWorkflowAsync(string definitionId, StartWorkflowRuntimeParams? options
 022    public Task<WorkflowExecutionResult?> ResumeWorkflowAsync(string workflowInstanceId, ResumeWorkflowRuntimeParams? op
 023    public Task<ICollection<WorkflowExecutionResult>> ResumeWorkflowsAsync(string activityTypeName, object bookmarkPaylo
 024    public Task<TriggerWorkflowsResult> TriggerWorkflowsAsync(string activityTypeName, object bookmarkPayload, TriggerWo
 025    public Task<WorkflowExecutionResult> ExecuteWorkflowAsync(WorkflowMatch match, ExecuteWorkflowParams? options = null
 026    public Task<CancellationResult> CancelWorkflowAsync(string workflowInstanceId, CancellationToken cancellationToken =
 027    public Task<IEnumerable<WorkflowMatch>> FindWorkflowsAsync(WorkflowsFilter filter, CancellationToken cancellationTok
 028    public Task<WorkflowState?> ExportWorkflowStateAsync(string workflowInstanceId, CancellationToken cancellationToken 
 029    public Task ImportWorkflowStateAsync(WorkflowState workflowState, CancellationToken cancellationToken = default) => 
 030    public Task UpdateBookmarkAsync(StoredBookmark bookmark, CancellationToken cancellationToken = default) => ObsoleteA
 031    public Task<long> CountRunningWorkflowsAsync(CountRunningWorkflowsRequest request, CancellationToken cancellationTok
 32}

Methods/Properties

.ctor(System.IServiceProvider,Elsa.Workflows.IIdentityGenerator)
CreateClientAsync()
CreateClientAsync(System.String,System.Threading.CancellationToken)
get_ObsoleteApi()
CanStartWorkflowAsync(System.String,Elsa.Workflows.Runtime.Parameters.StartWorkflowRuntimeParams)
StartWorkflowAsync(System.String,Elsa.Workflows.Runtime.Parameters.StartWorkflowRuntimeParams)
StartWorkflowsAsync(System.String,System.Object,Elsa.Workflows.Runtime.Options.TriggerWorkflowsOptions)
TryStartWorkflowAsync(System.String,Elsa.Workflows.Runtime.Parameters.StartWorkflowRuntimeParams)
ResumeWorkflowAsync(System.String,Elsa.Workflows.Runtime.Parameters.ResumeWorkflowRuntimeParams)
ResumeWorkflowsAsync(System.String,System.Object,Elsa.Workflows.Runtime.Options.TriggerWorkflowsOptions)
TriggerWorkflowsAsync(System.String,System.Object,Elsa.Workflows.Runtime.Options.TriggerWorkflowsOptions)
ExecuteWorkflowAsync(Elsa.Workflows.Runtime.Matches.WorkflowMatch,Elsa.Workflows.Runtime.Params.ExecuteWorkflowParams)
CancelWorkflowAsync(System.String,System.Threading.CancellationToken)
FindWorkflowsAsync(Elsa.Workflows.Runtime.Filters.WorkflowsFilter,System.Threading.CancellationToken)
ExportWorkflowStateAsync(System.String,System.Threading.CancellationToken)
ImportWorkflowStateAsync(Elsa.Workflows.State.WorkflowState,System.Threading.CancellationToken)
UpdateBookmarkAsync(Elsa.Workflows.Runtime.Entities.StoredBookmark,System.Threading.CancellationToken)
CountRunningWorkflowsAsync(Elsa.Workflows.Runtime.Requests.CountRunningWorkflowsRequest,System.Threading.CancellationToken)