< Summary

Line coverage
40%
Covered lines: 10
Uncovered lines: 15
Coverable lines: 25
Total lines: 72
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/Services/LocalWorkflowRuntime.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2
 3namespace Elsa.Workflows.Runtime;
 4
 5/// <summary>
 6/// Represents a local implementation of the distributed runtime for running workflows.
 7/// It does not support clustering and is intended for single-node deployments only.
 8/// For distributed deployments, use Proto.Actor or another distributed runtime.
 9/// </summary>
 10public partial class LocalWorkflowRuntime : IWorkflowRuntime
 11{
 12    private readonly IServiceProvider _serviceProvider;
 13    private readonly IIdentityGenerator _identityGenerator;
 14
 15    /// <summary>
 16    /// Represents a local implementation of the distributed runtime for running workflows.
 17    /// It does not support clustering and is intended for single-node deployments only.
 18    /// For distributed deployments, use Proto.Actor or another distributed runtime.
 19    /// </summary>
 5320    public LocalWorkflowRuntime(IServiceProvider serviceProvider, IIdentityGenerator identityGenerator)
 21    {
 5322        _serviceProvider = serviceProvider;
 5323        _identityGenerator = identityGenerator;
 5324        _obsoleteApi = new(() => ObsoleteWorkflowRuntime.Create(serviceProvider, CreateClientAsync));
 5325    }
 26
 27    /// <inheritdoc />
 28    public async ValueTask<IWorkflowClient> CreateClientAsync(CancellationToken cancellationToken = default)
 29    {
 4430        return await CreateClientAsync(null, cancellationToken);
 4431    }
 32
 33    /// <inheritdoc />
 34    public ValueTask<IWorkflowClient> CreateClientAsync(string? workflowInstanceId, CancellationToken cancellationToken 
 35    {
 4836        workflowInstanceId ??= _identityGenerator.GenerateId();
 4837        var client = (IWorkflowClient)ActivatorUtilities.CreateInstance(_serviceProvider, typeof(LocalWorkflowClient), w
 4838        return new(client);
 39    }
 40}

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.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;
 12
 13public partial class LocalWorkflowRuntime
 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 = defa
 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)