From 220a1b45938eeeb37ec4791c1a27ee62c6376098 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Fri, 2 Sep 2022 13:36:03 +0200 Subject: [PATCH] Cleanup --- .../Middleware/HttpTriggerMiddleware.cs | 14 +-- .../Endpoints/Events/Trigger/Models.cs | 11 +-- .../Abstractions/StimulusHandler.cs | 17 ---- .../WorkflowInstructionInterpreter.cs | 27 ------ .../DependencyInjectionExtensions.cs | 2 - .../Implementations/StimulusInterpreter.cs | 20 ----- .../WorkflowInstructionExecutor.cs | 42 --------- .../Implementations/WorkflowService.cs | 88 ------------------- .../DispatchWorkflowInstructionResult.cs | 3 - .../Elsa.Workflows.Runtime/Models/Stimulus.cs | 22 ----- .../Services/IStimulus.cs | 5 -- .../Services/IStimulusHandler.cs | 7 -- .../Services/IStimulusInterpreter.cs | 6 -- .../Services/IWorkflowInstruction.cs | 5 -- .../Services/IWorkflowInstructionExecutor.cs | 11 --- .../IWorkflowInstructionInterpreter.cs | 10 --- .../Services/IWorkflowInstructionScheduler.cs | 9 -- .../Services/IWorkflowService.cs | 22 ----- .../ResumeWorkflowsStimulusHandler.cs | 19 ---- .../TriggerWorkflowsStimulusHandler.cs | 22 ----- .../Stimuli/StandardStimulus.cs | 8 -- 21 files changed, 3 insertions(+), 367 deletions(-) delete mode 100644 src/modules/Elsa.Workflows.Runtime/Abstractions/StimulusHandler.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Abstractions/WorkflowInstructionInterpreter.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Implementations/StimulusInterpreter.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowInstructionExecutor.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowService.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Models/DispatchWorkflowInstructionResult.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Models/Stimulus.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IStimulus.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IStimulusHandler.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IStimulusInterpreter.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstruction.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionExecutor.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionInterpreter.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionScheduler.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Services/IWorkflowService.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/ResumeWorkflowsStimulusHandler.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/TriggerWorkflowsStimulusHandler.cs delete mode 100644 src/modules/Elsa.Workflows.Runtime/Stimuli/StandardStimulus.cs diff --git a/src/modules/Elsa.Http/Middleware/HttpTriggerMiddleware.cs b/src/modules/Elsa.Http/Middleware/HttpTriggerMiddleware.cs index f0f847629..188fe5d5d 100644 --- a/src/modules/Elsa.Http/Middleware/HttpTriggerMiddleware.cs +++ b/src/modules/Elsa.Http/Middleware/HttpTriggerMiddleware.cs @@ -66,19 +66,9 @@ public class HttpTriggerMiddleware ); var input = new Dictionary() { [HttpEndpoint.InputKey] = requestModel }; - // var stimulus = Stimulus.Standard(hash, input); - // var executionResults = (await workflowService.ExecuteStimulusAsync(stimulus, abortToken)).ToList(); - // - // if (!executionResults.Any()) - // { - // await _next(httpContext); - // return; - // } - - //await WriteResponseAsync(httpContext, executionResults, abortToken); } - private static async Task WriteResponseAsync(HttpContext httpContext, IEnumerable executionResults, CancellationToken cancellationToken) + private static async Task WriteResponseAsync(HttpContext httpContext, CancellationToken cancellationToken) { var response = httpContext.Response; @@ -89,7 +79,7 @@ public class HttpTriggerMiddleware var model = new { - workflowInstanceIds = executionResults.Select(x => x.RunWorkflowResult.WorkflowState.Id).ToArray() + workflowInstanceIds = Array.Empty(), }; var json = JsonSerializer.Serialize(model); diff --git a/src/modules/Elsa.Workflows.Api/Endpoints/Events/Trigger/Models.cs b/src/modules/Elsa.Workflows.Api/Endpoints/Events/Trigger/Models.cs index ebad5c7ca..db1bcca3f 100644 --- a/src/modules/Elsa.Workflows.Api/Endpoints/Events/Trigger/Models.cs +++ b/src/modules/Elsa.Workflows.Api/Endpoints/Events/Trigger/Models.cs @@ -1,19 +1,10 @@ -using System.Collections.Generic; -using Elsa.Workflows.Runtime.Models; - namespace Elsa.Workflows.Api.Endpoints.Events.Trigger; public class Request { - public string EventName { get; set; } + public string EventName { get; set; } = default!; } public class Response { - public Response(ICollection items) - { - Items = items; - } - - public ICollection Items { get; set; } } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Abstractions/StimulusHandler.cs b/src/modules/Elsa.Workflows.Runtime/Abstractions/StimulusHandler.cs deleted file mode 100644 index d2bb5fc5f..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Abstractions/StimulusHandler.cs +++ /dev/null @@ -1,17 +0,0 @@ -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Abstractions; -// -// public abstract class StimulusHandler : IStimulusHandler where TStimulus:IStimulus -// { -// bool IStimulusHandler.GetSupportsStimulus(IStimulus stimulus) => stimulus is TStimulus; -// ValueTask> IStimulusHandler.GetInstructionsAsync(IStimulus stimulus, CancellationToken cancellationToken) => GetInstructionsAsync((TStimulus)stimulus, cancellationToken); -// -// protected virtual ValueTask> GetInstructionsAsync(TStimulus stimulus, CancellationToken cancellationToken = default) -// { -// var instruction = GetInstructions(stimulus); -// return ValueTask.FromResult(instruction); -// } -// -// protected virtual IEnumerable GetInstructions(TStimulus stimulus) => ArraySegment.Empty; -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Abstractions/WorkflowInstructionInterpreter.cs b/src/modules/Elsa.Workflows.Runtime/Abstractions/WorkflowInstructionInterpreter.cs deleted file mode 100644 index 290dfac0d..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Abstractions/WorkflowInstructionInterpreter.cs +++ /dev/null @@ -1,27 +0,0 @@ -// using Elsa.Workflows.Runtime.Models; -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Abstractions; -// -// public abstract class WorkflowInstructionInterpreter : IWorkflowInstructionInterpreter where TInstruction: IWorkflowInstruction -// { -// bool IWorkflowInstructionInterpreter.GetSupportsInstruction(IWorkflowInstruction instruction) => instruction is TInstruction; -// -// ValueTask IWorkflowInstructionInterpreter.ExecuteInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken) => ExecuteInstructionAsync((TInstruction)instruction, cancellationToken); -// ValueTask IWorkflowInstructionInterpreter.DispatchInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken) => DispatchInstructionAsync((TInstruction)instruction, cancellationToken); -// -// protected virtual ValueTask ExecuteInstructionAsync(TInstruction instruction, CancellationToken cancellationToken = default) -// { -// var result = ExecuteInstruction(instruction); -// return ValueTask.FromResult(result); -// } -// -// protected virtual ValueTask DispatchInstructionAsync(TInstruction instruction, CancellationToken cancellationToken = default) -// { -// var result = DispatchInstruction(instruction); -// return ValueTask.FromResult(result); -// } -// -// protected virtual ExecuteWorkflowInstructionResult? ExecuteInstruction(TInstruction instruction) => null; -// protected virtual DispatchWorkflowInstructionResult? DispatchInstruction(TInstruction instruction) => null; -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Extensions/DependencyInjectionExtensions.cs b/src/modules/Elsa.Workflows.Runtime/Extensions/DependencyInjectionExtensions.cs index 09550012e..05f945035 100644 --- a/src/modules/Elsa.Workflows.Runtime/Extensions/DependencyInjectionExtensions.cs +++ b/src/modules/Elsa.Workflows.Runtime/Extensions/DependencyInjectionExtensions.cs @@ -14,6 +14,4 @@ public static class DependencyInjectionExtensions } public static IServiceCollection AddWorkflowDefinitionProvider(this IServiceCollection services) where T : class, IWorkflowDefinitionProvider => services.AddSingleton(); - // public static IServiceCollection AddStimulusHandler(this IServiceCollection services) where T : class, IStimulusHandler => services.AddSingleton(); - // public static IServiceCollection AddInstructionInterpreter(this IServiceCollection services) where T : class, IWorkflowInstructionInterpreter => services.AddSingleton(); } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Implementations/StimulusInterpreter.cs b/src/modules/Elsa.Workflows.Runtime/Implementations/StimulusInterpreter.cs deleted file mode 100644 index 090a0e71c..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Implementations/StimulusInterpreter.cs +++ /dev/null @@ -1,20 +0,0 @@ -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Implementations; -// -// public class StimulusInterpreter : IStimulusInterpreter -// { -// private readonly IEnumerable _workflowExecutionInstructionProviders; -// -// public StimulusInterpreter(IEnumerable workflowExecutionInstructionProviders) -// { -// _workflowExecutionInstructionProviders = workflowExecutionInstructionProviders; -// } -// -// public async Task> GetExecutionInstructionsAsync(IStimulus stimulus, CancellationToken cancellationToken = default) -// { -// var providers = _workflowExecutionInstructionProviders.Where(x => x.GetSupportsStimulus(stimulus)).ToList(); -// var tasks = providers.Select(x => x.GetInstructionsAsync(stimulus, cancellationToken).AsTask()); -// return (await Task.WhenAll(tasks)).SelectMany(x => x); -// } -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowInstructionExecutor.cs b/src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowInstructionExecutor.cs deleted file mode 100644 index 433313d7e..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowInstructionExecutor.cs +++ /dev/null @@ -1,42 +0,0 @@ -// using Elsa.Workflows.Runtime.Models; -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Implementations; -// -// public class WorkflowInstructionExecutor : IWorkflowInstructionExecutor -// { -// private readonly IEnumerable _workflowExecutionInstructionHandlers; -// -// public WorkflowInstructionExecutor(IEnumerable workflowExecutionInstructionHandlers) -// { -// _workflowExecutionInstructionHandlers = workflowExecutionInstructionHandlers; -// } -// -// public async Task> ExecuteInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default) -// { -// var handlers = _workflowExecutionInstructionHandlers.Where(x => x.GetSupportsInstruction(instruction)).ToList(); -// var tasks = handlers.Select(x => x.ExecuteInstructionAsync(instruction, cancellationToken).AsTask()); -// var results = await Task.WhenAll(tasks); -// return results.Where(x => x != null).Select(x => x!).ToList(); -// } -// -// public async Task> ExecuteInstructionsAsync(IEnumerable instructions, CancellationToken cancellationToken = default) -// { -// var tasks = instructions.Select(x => ExecuteInstructionAsync(x, cancellationToken)); -// return (await Task.WhenAll(tasks)).SelectMany(x => x); -// } -// -// public async Task> DispatchInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default) -// { -// var handlers = _workflowExecutionInstructionHandlers.Where(x => x.GetSupportsInstruction(instruction)).ToList(); -// var tasks = handlers.Select(x => x.DispatchInstructionAsync(instruction, cancellationToken).AsTask()); -// var results = await Task.WhenAll(tasks); -// return results.Where(x => x != null).Select(x => x!).ToList(); -// } -// -// public async Task> DispatchInstructionsAsync(IEnumerable instructions, CancellationToken cancellationToken = default) -// { -// var tasks = instructions.Select(x => DispatchInstructionAsync(x, cancellationToken)); -// return (await Task.WhenAll(tasks)).SelectMany(x => x); -// } -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowService.cs b/src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowService.cs deleted file mode 100644 index 127e668e2..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Implementations/WorkflowService.cs +++ /dev/null @@ -1,88 +0,0 @@ -// using Elsa.Models; -// using Elsa.Workflows.Core.Models; -// using Elsa.Workflows.Core.Services; -// using Elsa.Workflows.Persistence.Entities; -// using Elsa.Workflows.Runtime.Models; -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Implementations; -// -// public class WorkflowService : IWorkflowService -// { -// private readonly IWorkflowInvoker _workflowInvoker; -// private readonly IWorkflowDispatcher _workflowDispatcher; -// private readonly IHasher _hasher; -// -// public WorkflowService( -// IWorkflowInvoker workflowInvoker, -// IWorkflowDispatcher workflowDispatcher, -// IHasher hasher) -// { -// _workflowInvoker = workflowInvoker; -// _workflowDispatcher = workflowDispatcher; -// _hasher = hasher; -// } -// -// public async Task ExecuteWorkflowAsync(string definitionId, VersionOptions versionOptions, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default) -// { -// var executeRequest = new InvokeWorkflowDefinitionRequest(definitionId, versionOptions, input, correlationId); -// var result = await _workflowInvoker.InvokeAsync(executeRequest, cancellationToken); -// -// return new ExecuteWorkflowResult(result.WorkflowState, result.Bookmarks); -// } -// -// public async Task ExecuteWorkflowAsync(string instanceId, Bookmark bookmark, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default) -// { -// var request = new InvokeWorkflowInstanceRequest(instanceId, bookmark, input, correlationId); -// var result = await _workflowInvoker.InvokeAsync(request, cancellationToken); -// return new ExecuteWorkflowResult(result.WorkflowState, result.Bookmarks); -// } -// -// public async Task DispatchWorkflowAsync(string definitionId, VersionOptions versionOptions, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default) -// { -// var executeRequest = new DispatchWorkflowDefinitionRequest(definitionId, versionOptions, input, correlationId); -// return await _workflowDispatcher.DispatchAsync(executeRequest, cancellationToken); -// } -// -// public async Task DispatchWorkflowAsync(string instanceId, Bookmark bookmark, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default) -// { -// var request = new DispatchWorkflowInstanceRequest(instanceId, bookmark, input, correlationId); -// return await _workflowDispatcher.DispatchAsync(request, cancellationToken); -// } -// -// protected override async ValueTask ResumeWorkflowAsync(WorkflowBookmark workflowBookmark, CancellationToken cancellationToken = default) -// { -// // var workflowDefinitionId = workflowBookmark.WorkflowDefinitionId; -// // var workflowInstanceId = workflowBookmark.WorkflowInstanceId; -// // var workflowInstance = await _workflowInstanceStore.FindByIdAsync(workflowInstanceId, cancellationToken); -// // -// // if (workflowInstance == null) -// // { -// // _logger -// // .LogWarning( -// // "Workflow bookmark {WorkflowBookmarkId} for workflow definition {WorkflowDefinitionId} references workflow instance ID {WorkflowInstanceId}, but no such workflow instance was found", workflowBookmark.Id, workflowBookmark.WorkflowDefinitionId, workflowBookmark.WorkflowInstanceId); -// // -// // return null; -// // } -// // -// // var definition = (await _workflowDefinitionStore.FindManyByDefinitionIdAsync(workflowDefinitionId, VersionOptions.SpecificVersion(workflowInstance.Version), cancellationToken)).FirstOrDefault(); -// // -// // if (definition == null) -// // { -// // _logger.LogWarning("Workflow bookmark {WorkflowBookmarkId} references workflow definition ID {WorkflowDefinitionId}, but no such workflow definition was found", workflowBookmark.Id, workflowBookmark.WorkflowDefinitionId); -// // return null; -// // } -// // -// // // Resume workflow instance. -// // var bookmark = new Bookmark(workflowBookmark.Id, workflowBookmark.Name, workflowBookmark.Hash, workflowBookmark.Data, workflowBookmark.ActivityId, workflowBookmark.ActivityInstanceId, workflowBookmark.CallbackMethodName); -// // var workflowState = workflowInstance.WorkflowState; -// // var input = instruction.Input; -// // var workflow = await _workflowDefinitionService.MaterializeWorkflowAsync(definition, cancellationToken); -// // var workflowExecutionResult = await _workflowInvoker.InvokeAsync(workflow, workflowState, bookmark, input, cancellationToken); -// // -// // // Update workflow instance with new workflow state. -// // workflowInstance.WorkflowState = workflowExecutionResult.WorkflowState; -// // -// // return new ExecuteWorkflowInstructionResult(workflowExecutionResult); -// } -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Models/DispatchWorkflowInstructionResult.cs b/src/modules/Elsa.Workflows.Runtime/Models/DispatchWorkflowInstructionResult.cs deleted file mode 100644 index 828a0dd75..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Models/DispatchWorkflowInstructionResult.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Elsa.Workflows.Runtime.Models; - -public record DispatchWorkflowInstructionResult(); \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Models/Stimulus.cs b/src/modules/Elsa.Workflows.Runtime/Models/Stimulus.cs deleted file mode 100644 index eef7c3961..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Models/Stimulus.cs +++ /dev/null @@ -1,22 +0,0 @@ -// using Elsa.Workflows.Core; -// using Elsa.Workflows.Core.Helpers; -// using Elsa.Workflows.Core.Services; -// using Elsa.Workflows.Runtime.Stimuli; -// -// namespace Elsa.Workflows.Runtime.Models; -// -// public static class Stimulus -// { -// public static StandardStimulus Standard(string? hash = default, IDictionary? input = default, string? correlationId = default) where T : IActivity => -// new(ActivityTypeNameHelper.GenerateTypeName(), hash, input, correlationId); -// -// public static StandardStimulus Standard(string? hash, object input, string? correlationId = default) where T : IActivity => -// new(ActivityTypeNameHelper.GenerateTypeName(), hash, input.ToDictionary(), correlationId); -// -// public static StandardStimulus Standard(object input, string? correlationId = default) where T : IActivity => -// new(ActivityTypeNameHelper.GenerateTypeName(), default, input.ToDictionary(), correlationId); -// -// public static StandardStimulus Standard(string activityTypeName, string? hash = default, IDictionary? input = default, string? correlationId = default) => new(activityTypeName, hash, input, correlationId); -// public static StandardStimulus Standard(string activityTypeName, string? hash, object? input, string? correlationId = default) => new(activityTypeName, hash, input?.ToDictionary(), correlationId); -// public static StandardStimulus Standard(string activityTypeName, object? input, string? correlationId = default) => new(activityTypeName, default, input?.ToDictionary(), correlationId); -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IStimulus.cs b/src/modules/Elsa.Workflows.Runtime/Services/IStimulus.cs deleted file mode 100644 index c0204c044..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IStimulus.cs +++ /dev/null @@ -1,5 +0,0 @@ -// namespace Elsa.Workflows.Runtime.Services; -// -// public interface IStimulus -// { -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IStimulusHandler.cs b/src/modules/Elsa.Workflows.Runtime/Services/IStimulusHandler.cs deleted file mode 100644 index 0d5d1909e..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IStimulusHandler.cs +++ /dev/null @@ -1,7 +0,0 @@ -// namespace Elsa.Workflows.Runtime.Services; -// -// public interface IStimulusHandler -// { -// bool GetSupportsStimulus(IStimulus stimulus); -// ValueTask> GetInstructionsAsync(IStimulus stimulus, CancellationToken cancellationToken = default); -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IStimulusInterpreter.cs b/src/modules/Elsa.Workflows.Runtime/Services/IStimulusInterpreter.cs deleted file mode 100644 index c7cf64038..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IStimulusInterpreter.cs +++ /dev/null @@ -1,6 +0,0 @@ -// namespace Elsa.Workflows.Runtime.Services; -// -// public interface IStimulusInterpreter -// { -// Task> GetExecutionInstructionsAsync(IStimulus stimulus, CancellationToken cancellationToken = default); -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstruction.cs b/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstruction.cs deleted file mode 100644 index 6eb369ff0..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstruction.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Elsa.Workflows.Runtime.Services; - -public interface IWorkflowInstruction -{ -} \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionExecutor.cs b/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionExecutor.cs deleted file mode 100644 index f3c8b54b5..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionExecutor.cs +++ /dev/null @@ -1,11 +0,0 @@ -// using Elsa.Workflows.Runtime.Models; -// -// namespace Elsa.Workflows.Runtime.Services; -// -// public interface IWorkflowInstructionExecutor -// { -// Task> ExecuteInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default); -// Task> ExecuteInstructionsAsync(IEnumerable instructions, CancellationToken cancellationToken = default); -// Task> DispatchInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default); -// Task> DispatchInstructionsAsync(IEnumerable instructions, CancellationToken cancellationToken = default); -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionInterpreter.cs b/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionInterpreter.cs deleted file mode 100644 index bd5319bc5..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionInterpreter.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Elsa.Workflows.Runtime.Models; - -namespace Elsa.Workflows.Runtime.Services; - -public interface IWorkflowInstructionInterpreter -{ - bool GetSupportsInstruction(IWorkflowInstruction instruction); - ValueTask ExecuteInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default); - ValueTask DispatchInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default); -} \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionScheduler.cs b/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionScheduler.cs deleted file mode 100644 index 1d02fd590..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowInstructionScheduler.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Elsa.Workflows.Runtime.Models; - -namespace Elsa.Workflows.Runtime.Services; - -public interface IWorkflowInstructionScheduler -{ - Task> ScheduleInstructionAsync(IWorkflowInstruction instruction, CancellationToken cancellationToken = default); - Task> ScheduleInstructionsAsync(IEnumerable instructions, CancellationToken cancellationToken = default); -} \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowService.cs b/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowService.cs deleted file mode 100644 index 1898f486d..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Services/IWorkflowService.cs +++ /dev/null @@ -1,22 +0,0 @@ -// using Elsa.Models; -// using Elsa.Workflows.Core.Models; -// using Elsa.Workflows.Runtime.Models; -// -// namespace Elsa.Workflows.Runtime.Services; -// -// /// -// /// Represents a high-level service to invoke workflows. -// /// -// public interface IWorkflowService -// { -// Task ExecuteWorkflowAsync(string definitionId, VersionOptions versionOptions, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default); -// Task ExecuteWorkflowAsync(string instanceId, Bookmark bookmark, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default); -// Task DispatchWorkflowAsync(string definitionId, VersionOptions versionOptions, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default); -// Task DispatchWorkflowAsync(string instanceId, Bookmark bookmark, IDictionary? input = default, string? correlationId = default, CancellationToken cancellationToken = default); -// // Task> ExecuteStimulusAsync(IStimulus stimulus, CancellationToken cancellationToken = default); -// // Task> DispatchStimulusAsync(IStimulus stimulus, CancellationToken cancellationToken = default); -// // Task> DispatchStimulusAsync(string bookmarkName, object bookmarkPayload, object inputs, string? correlationId = default, CancellationToken cancellationToken = default); -// // Task> DispatchStimulusAsync(string bookmarkName, object bookmarkPayload, IDictionary inputs, string? correlationId = default, CancellationToken cancellationToken = default); -// // Task> DispatchStimulusAsync(string bookmarkName, object bookmarkPayload, string? correlationId = default, CancellationToken cancellationToken = default); -// -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/ResumeWorkflowsStimulusHandler.cs b/src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/ResumeWorkflowsStimulusHandler.cs deleted file mode 100644 index 6886337ee..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/ResumeWorkflowsStimulusHandler.cs +++ /dev/null @@ -1,19 +0,0 @@ -// using Elsa.Workflows.Persistence.Services; -// using Elsa.Workflows.Runtime.Abstractions; -// using Elsa.Workflows.Runtime.Interpreters; -// using Elsa.Workflows.Runtime.Services; -// using Open.Linq.AsyncExtensions; -// -// namespace Elsa.Workflows.Runtime.Stimuli.Handlers; -// -// public class ResumeWorkflowsStimulusHandler : StimulusHandler -// { -// private readonly IWorkflowBookmarkStore _bookmarkStore; -// public ResumeWorkflowsStimulusHandler(IWorkflowBookmarkStore bookmarkStore) => _bookmarkStore = bookmarkStore; -// -// protected override async ValueTask> GetInstructionsAsync(StandardStimulus stimulus, CancellationToken cancellationToken = default) -// { -// var workflowBookmarks = await _bookmarkStore.FindManyAsync(stimulus.ActivityTypeName, stimulus.Hash, cancellationToken).ToList(); -// return workflowBookmarks.Select(x => new ResumeWorkflowInstruction(x, stimulus.Input, stimulus.CorrelationId)); -// } -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/TriggerWorkflowsStimulusHandler.cs b/src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/TriggerWorkflowsStimulusHandler.cs deleted file mode 100644 index 1b4fe7073..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Stimuli/Handlers/TriggerWorkflowsStimulusHandler.cs +++ /dev/null @@ -1,22 +0,0 @@ -// using Elsa.Workflows.Persistence.Services; -// using Elsa.Workflows.Runtime.Abstractions; -// using Elsa.Workflows.Runtime.Interpreters; -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Stimuli.Handlers; -// -// public class TriggerWorkflowsStimulusHandler : StimulusHandler -// { -// private readonly IWorkflowTriggerStore _workflowTriggerStore; -// -// public TriggerWorkflowsStimulusHandler(IWorkflowTriggerStore workflowTriggerStore) -// { -// _workflowTriggerStore = workflowTriggerStore; -// } -// -// protected override async ValueTask> GetInstructionsAsync(StandardStimulus stimulus, CancellationToken cancellationToken = default) -// { -// var workflowTriggers = (await _workflowTriggerStore.FindManyByNameAsync(stimulus.ActivityTypeName, stimulus.Hash, cancellationToken)).ToList(); -// return workflowTriggers.Select(x => new TriggerWorkflowInstruction(x, stimulus.Input, stimulus.CorrelationId)); -// } -// } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Stimuli/StandardStimulus.cs b/src/modules/Elsa.Workflows.Runtime/Stimuli/StandardStimulus.cs deleted file mode 100644 index a08e9b0d7..000000000 --- a/src/modules/Elsa.Workflows.Runtime/Stimuli/StandardStimulus.cs +++ /dev/null @@ -1,8 +0,0 @@ -// using Elsa.Workflows.Runtime.Services; -// -// namespace Elsa.Workflows.Runtime.Stimuli; -// -// /// -// /// Represents a simple stimulus that targets a specific activity type and optionally a corresponding hash to use as a bookmark lookup. -// /// -// public record StandardStimulus(string ActivityTypeName, string? Hash = default, IDictionary? Input = default, string? CorrelationId = default) : IStimulus; \ No newline at end of file