| | | 1 | | using Elsa.Common; |
| | | 2 | | using Elsa.Extensions; |
| | | 3 | | using Elsa.Features.Abstractions; |
| | | 4 | | using Elsa.Features.Attributes; |
| | | 5 | | using Elsa.Features.Services; |
| | | 6 | | using Elsa.Resilience.Features; |
| | | 7 | | using Elsa.Workflows.Runtime.Distributed.StartupTasks; |
| | | 8 | | using Elsa.Workflows.Runtime.Features; |
| | | 9 | | using Microsoft.Extensions.DependencyInjection; |
| | | 10 | | using Microsoft.Extensions.DependencyInjection.Extensions; |
| | | 11 | | |
| | | 12 | | namespace Elsa.Workflows.Runtime.Distributed.Features; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Installs and configures workflow runtime features. |
| | | 16 | | /// </summary> |
| | | 17 | | [DependsOn(typeof(WorkflowRuntimeFeature))] |
| | | 18 | | [DependsOn(typeof(ResilienceFeature))] |
| | 5 | 19 | | public class DistributedRuntimeFeature(IModule module) : FeatureBase(module) |
| | | 20 | | { |
| | | 21 | | public override void Configure() |
| | | 22 | | { |
| | 5 | 23 | | Module.UseWorkflowRuntime(runtime => |
| | 5 | 24 | | { |
| | 355 | 25 | | runtime.WorkflowRuntime = sp => sp.GetRequiredService<DistributedWorkflowRuntime>(); |
| | 7 | 26 | | runtime.BookmarkQueueWorker = sp => sp.GetRequiredService<DistributedBookmarkQueueWorker>(); |
| | 10 | 27 | | }); |
| | 5 | 28 | | } |
| | | 29 | | |
| | | 30 | | /// <inheritdoc /> |
| | | 31 | | public override void Apply() |
| | | 32 | | { |
| | 5 | 33 | | Services |
| | 5 | 34 | | .AddScoped<DistributedWorkflowRuntime>() |
| | 5 | 35 | | .AddScoped<DistributedBookmarkQueueWorker>() |
| | 5 | 36 | | |
| | 5 | 37 | | .Decorate<IWorkflowDefinitionsRefresher, DistributedWorkflowDefinitionsRefresher>() |
| | 5 | 38 | | .Decorate<IWorkflowDefinitionsReloader, DistributedWorkflowDefinitionsReloader>(); |
| | | 39 | | |
| | 5 | 40 | | Services.TryAddScoped<DistributedRuntimeLockProviderValidator>(); |
| | 5 | 41 | | Services.TryAddEnumerable(ServiceDescriptor.Scoped<IStartupTask, ValidateDistributedRuntimeLockProviderStartupTa |
| | 5 | 42 | | } |
| | | 43 | | } |