Refactor workflow runtime structure and update handlers.
Moved `CancelWorkflowsCommandHandler` to the shared runtime module. Updated related project references, features, and configurations accordingly. Improved `WorkflowInstance` actor to save state using `IWorkflowInstanceManager`.
This commit is contained in:
parent
be68b4c33f
commit
5e2644f751
|
|
@ -74,7 +74,7 @@ const bool useAzureServiceBus = false;
|
|||
const bool useKafka = false;
|
||||
const bool useReadOnlyMode = false;
|
||||
const bool useSignalR = false; // Disabled until Elsa Studio sends authenticated requests.
|
||||
const WorkflowRuntime workflowRuntime = WorkflowRuntime.Distributed;
|
||||
const WorkflowRuntime workflowRuntime = WorkflowRuntime.ProtoActor;
|
||||
const DistributedCachingTransport distributedCachingTransport = DistributedCachingTransport.MassTransit;
|
||||
const MassTransitBroker massTransitBroker = MassTransitBroker.Memory;
|
||||
const bool useMultitenancy = false;
|
||||
|
|
|
|||
|
|
@ -18,4 +18,8 @@
|
|||
<ProjectReference Include="..\Elsa.Workflows.Runtime\Elsa.Workflows.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Handlers\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ using Elsa.Extensions;
|
|||
using Elsa.Features.Abstractions;
|
||||
using Elsa.Features.Attributes;
|
||||
using Elsa.Features.Services;
|
||||
using Elsa.Workflows.Runtime.Distributed.Handlers;
|
||||
using Elsa.Workflows.Runtime.Features;
|
||||
using Elsa.Workflows.Runtime.Handlers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Elsa.Workflows.Runtime.Distributed.Features;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,8 @@ internal class WorkflowInstance(
|
|||
var workflowRunner = scope.ServiceProvider.GetRequiredService<IWorkflowRunner>();
|
||||
var workflowResult = await workflowRunner.RunAsync(WorkflowGraph, WorkflowState, runWorkflowOptions, _linkedCancellationToken);
|
||||
WorkflowState = workflowResult.WorkflowState;
|
||||
var workflowInstanceManager = scope.ServiceProvider.GetRequiredService<IWorkflowInstanceManager>();
|
||||
await workflowInstanceManager.SaveAsync(WorkflowState, Context.CancellationToken);
|
||||
|
||||
return workflowResult;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,15 +8,4 @@ namespace Elsa.Workflows.Runtime.Features;
|
|||
/// Installs the default runtime services.
|
||||
/// </summary>
|
||||
[DependsOn(typeof(WorkflowRuntimeFeature))]
|
||||
public class DefaultWorkflowRuntimeFeature : FeatureBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public DefaultWorkflowRuntimeFeature(IModule module) : base(module)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Apply()
|
||||
{
|
||||
}
|
||||
}
|
||||
public class DefaultWorkflowRuntimeFeature(IModule module) : FeatureBase(module);
|
||||
|
|
@ -310,6 +310,7 @@ public class WorkflowRuntimeFeature : FeatureBase
|
|||
|
||||
// Domain handlers.
|
||||
.AddCommandHandler<DispatchWorkflowCommandHandler>()
|
||||
.AddCommandHandler<CancelWorkflowsCommandHandler>()
|
||||
.AddNotificationHandler<ResumeDispatchWorkflowActivity>()
|
||||
.AddNotificationHandler<ResumeBulkDispatchWorkflowActivity>()
|
||||
.AddNotificationHandler<ResumeExecuteWorkflowActivity>()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Elsa.Mediator.Contracts;
|
|||
using Elsa.Mediator.Models;
|
||||
using Elsa.Workflows.Runtime.Commands;
|
||||
|
||||
namespace Elsa.Workflows.Runtime.Distributed.Handlers;
|
||||
namespace Elsa.Workflows.Runtime.Handlers;
|
||||
|
||||
/// <summary>
|
||||
/// Handles the <see cref="CancelWorkflowsCommand"/>.
|
||||
Loading…
Reference in a new issue