From 9f01e148a96c2d7d594a4808fa78fb57a05bc026 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 28 Jan 2025 09:26:46 +0100 Subject: [PATCH] Deprecate and clean up legacy workflow runtime components. Marked various types as obsolete, advising migration to `CreateClientAsync` methods or `IBookmarkQueue` services. Removed unused `Deprecated` namespace imports, aligning code with updated runtime standards. --- .../Services/DistributedWorkflowRuntime.Obsolete.cs | 1 - .../Services/DistributedWorkflowRuntime.cs | 1 - .../Services/ProtoActorWorkflowRuntime.Obsolete.cs | 1 - .../Services/ProtoActorWorkflowRuntime.cs | 1 - .../Elsa.Workflows.Runtime/Filters/WorkflowsFilter.cs | 1 + .../Options/TriggerWorkflowsOptions.cs | 1 + .../Parameters/ResumeWorkflowRuntimeParams.cs | 1 + .../Parameters/StartWorkflowRuntimeParams.cs | 1 + .../Params/WorkflowInboxMessageDeliveryParams.cs | 1 + .../Requests/CountRunningWorkflowsRequest.cs | 1 + .../Elsa.Workflows.Runtime/Results/CancellationResult.cs | 3 ++- .../Services/LocalWorkflowRuntime.Obsolete.cs | 1 - .../Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.cs | 1 - .../{Deprecated => Services}/ObsoleteWorkflowRuntime.cs | 5 ++++- 14 files changed, 12 insertions(+), 8 deletions(-) rename src/modules/Elsa.Workflows.Runtime/{Deprecated => Services}/ObsoleteWorkflowRuntime.cs (98%) diff --git a/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs b/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs index 45c9fb00c..03860d555 100644 --- a/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs +++ b/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs @@ -1,4 +1,3 @@ -using Elsa.Workflows.Runtime.Deprecated; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Filters; using Elsa.Workflows.Runtime.Matches; diff --git a/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.cs b/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.cs index 4b0a6056b..9ce03bf52 100644 --- a/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.cs +++ b/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.cs @@ -1,5 +1,4 @@ using Elsa.Workflows.Management; -using Elsa.Workflows.Runtime.Deprecated; using Microsoft.Extensions.DependencyInjection; namespace Elsa.Workflows.Runtime.Distributed; diff --git a/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.Obsolete.cs b/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.Obsolete.cs index 6393c5149..9da1fe8a3 100644 --- a/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.Obsolete.cs +++ b/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.Obsolete.cs @@ -1,4 +1,3 @@ -using Elsa.Workflows.Runtime.Deprecated; using Elsa.Workflows.Runtime.Distributed; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Filters; diff --git a/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.cs b/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.cs index 98122f13b..b66d97ee8 100644 --- a/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.cs +++ b/src/modules/Elsa.Workflows.Runtime.ProtoActor/Services/ProtoActorWorkflowRuntime.cs @@ -1,4 +1,3 @@ -using Elsa.Workflows.Runtime.Deprecated; using Microsoft.Extensions.DependencyInjection; namespace Elsa.Workflows.Runtime.ProtoActor.Services; diff --git a/src/modules/Elsa.Workflows.Runtime/Filters/WorkflowsFilter.cs b/src/modules/Elsa.Workflows.Runtime/Filters/WorkflowsFilter.cs index 438446c5a..a6492d081 100644 --- a/src/modules/Elsa.Workflows.Runtime/Filters/WorkflowsFilter.cs +++ b/src/modules/Elsa.Workflows.Runtime/Filters/WorkflowsFilter.cs @@ -8,4 +8,5 @@ namespace Elsa.Workflows.Runtime.Filters; /// The activity type name to trigger workflows for. /// The bookmark payload to trigger workflows for. /// The options to use when triggering workflows. +[Obsolete("This type is obsolete. Use the new CreateClientAsync methods of IWorkflowRuntime instead.")] public record WorkflowsFilter(string ActivityTypeName, object BookmarkPayload, TriggerWorkflowsOptions Options); \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Options/TriggerWorkflowsOptions.cs b/src/modules/Elsa.Workflows.Runtime/Options/TriggerWorkflowsOptions.cs index 5ac0f1837..15a784823 100644 --- a/src/modules/Elsa.Workflows.Runtime/Options/TriggerWorkflowsOptions.cs +++ b/src/modules/Elsa.Workflows.Runtime/Options/TriggerWorkflowsOptions.cs @@ -3,6 +3,7 @@ namespace Elsa.Workflows.Runtime.Options; /// /// Options for triggering workflows. /// +[Obsolete("This type is obsolete. Use the new CreateClientAsync methods of IWorkflowRuntime instead.")] public class TriggerWorkflowsOptions { public string? CorrelationId { get; set; } diff --git a/src/modules/Elsa.Workflows.Runtime/Parameters/ResumeWorkflowRuntimeParams.cs b/src/modules/Elsa.Workflows.Runtime/Parameters/ResumeWorkflowRuntimeParams.cs index 6836fcc0b..b1b744071 100644 --- a/src/modules/Elsa.Workflows.Runtime/Parameters/ResumeWorkflowRuntimeParams.cs +++ b/src/modules/Elsa.Workflows.Runtime/Parameters/ResumeWorkflowRuntimeParams.cs @@ -5,6 +5,7 @@ namespace Elsa.Workflows.Runtime.Parameters; /// /// Options for resuming workflows. /// +[Obsolete("This type is obsolete. Use the new CreateClientAsync methods of IWorkflowRuntime instead.")] public class ResumeWorkflowRuntimeParams { public string? CorrelationId { get; set; } diff --git a/src/modules/Elsa.Workflows.Runtime/Parameters/StartWorkflowRuntimeParams.cs b/src/modules/Elsa.Workflows.Runtime/Parameters/StartWorkflowRuntimeParams.cs index d8e337c73..79a1dd72d 100644 --- a/src/modules/Elsa.Workflows.Runtime/Parameters/StartWorkflowRuntimeParams.cs +++ b/src/modules/Elsa.Workflows.Runtime/Parameters/StartWorkflowRuntimeParams.cs @@ -5,6 +5,7 @@ namespace Elsa.Workflows.Runtime.Parameters; /// /// Represents parameters for starting a workflow. /// +[Obsolete("This type is obsolete. Use the new CreateClientAsync methods of IWorkflowRuntime instead.")] public class StartWorkflowRuntimeParams { public string? CorrelationId { get; set; } diff --git a/src/modules/Elsa.Workflows.Runtime/Params/WorkflowInboxMessageDeliveryParams.cs b/src/modules/Elsa.Workflows.Runtime/Params/WorkflowInboxMessageDeliveryParams.cs index 5f800b381..b275ac64d 100644 --- a/src/modules/Elsa.Workflows.Runtime/Params/WorkflowInboxMessageDeliveryParams.cs +++ b/src/modules/Elsa.Workflows.Runtime/Params/WorkflowInboxMessageDeliveryParams.cs @@ -3,6 +3,7 @@ namespace Elsa.Workflows.Runtime.Params; /// /// Options for delivering a workflow inbox message. /// +[Obsolete("This type is obsolete. Use the new IBookmarkQueue service instead.")] public class WorkflowInboxMessageDeliveryParams { /// diff --git a/src/modules/Elsa.Workflows.Runtime/Requests/CountRunningWorkflowsRequest.cs b/src/modules/Elsa.Workflows.Runtime/Requests/CountRunningWorkflowsRequest.cs index 9fc36c54f..3d4cec8ac 100644 --- a/src/modules/Elsa.Workflows.Runtime/Requests/CountRunningWorkflowsRequest.cs +++ b/src/modules/Elsa.Workflows.Runtime/Requests/CountRunningWorkflowsRequest.cs @@ -3,6 +3,7 @@ namespace Elsa.Workflows.Runtime.Requests; /// /// Contains arguments to use for counting the number of workflow instances. /// +[Obsolete("This type is obsolete. Use the new CreateClientAsync methods of IWorkflowRuntime instead.")] public class CountRunningWorkflowsRequest { /// diff --git a/src/modules/Elsa.Workflows.Runtime/Results/CancellationResult.cs b/src/modules/Elsa.Workflows.Runtime/Results/CancellationResult.cs index 86092adb7..f40bf1a0b 100644 --- a/src/modules/Elsa.Workflows.Runtime/Results/CancellationResult.cs +++ b/src/modules/Elsa.Workflows.Runtime/Results/CancellationResult.cs @@ -5,4 +5,5 @@ namespace Elsa.Workflows.Runtime.Results; /// /// True if the operation was successful; otherwise, false. /// The reason for the failure, if any. -public record CancellationResult(bool Success, CancellationFailureReason? Reason = default); \ No newline at end of file +[Obsolete("This type is obsolete. Use the new CreateClientAsync methods of IWorkflowRuntime instead.")] +public record CancellationResult(bool Success, CancellationFailureReason? Reason = null); \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.Obsolete.cs b/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.Obsolete.cs index df5be09f7..7d9cfae0c 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.Obsolete.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.Obsolete.cs @@ -1,4 +1,3 @@ -using Elsa.Workflows.Runtime.Deprecated; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Filters; using Elsa.Workflows.Runtime.Matches; diff --git a/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.cs b/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.cs index 3f1414d58..b5f028fde 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.cs @@ -1,4 +1,3 @@ -using Elsa.Workflows.Runtime.Deprecated; using Microsoft.Extensions.DependencyInjection; namespace Elsa.Workflows.Runtime; diff --git a/src/modules/Elsa.Workflows.Runtime/Deprecated/ObsoleteWorkflowRuntime.cs b/src/modules/Elsa.Workflows.Runtime/Services/ObsoleteWorkflowRuntime.cs similarity index 98% rename from src/modules/Elsa.Workflows.Runtime/Deprecated/ObsoleteWorkflowRuntime.cs rename to src/modules/Elsa.Workflows.Runtime/Services/ObsoleteWorkflowRuntime.cs index 28087e8bc..9eb5c5af3 100644 --- a/src/modules/Elsa.Workflows.Runtime/Deprecated/ObsoleteWorkflowRuntime.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/ObsoleteWorkflowRuntime.cs @@ -14,8 +14,11 @@ using Elsa.Workflows.Runtime.Results; using Elsa.Workflows.State; using Open.Linq.AsyncExtensions; -namespace Elsa.Workflows.Runtime.Deprecated; +namespace Elsa.Workflows.Runtime; +/// +/// Implements the now deprecated workflow runtime API methods. +/// public class ObsoleteWorkflowRuntime( Func> createClientAsync, IWorkflowDefinitionService workflowDefinitionService,