elsa-core/src/modules
Sipke Schoorstra 568cefa629
Optimize Workflow Execution and Messaging (#5243)
* Add conditional index triggers in workflow populator

The trigger indexing in the workflow populator is now conditional. A boolean parameter has been added to the PopulateStoreAsync and AddAsync methods to determine whether to index triggers or not. Additionally, some code cleanups and refactoring have been made for efficient and cleaner code.

* Update method call in DefaultWorkflowRegistry

The method `AddAsync` in `DefaultWorkflowRegistry` has been updated to include a new first parameter set to true. This change aligns with recent modifications to the `AddAsync` method signature, ensuring proper function execution.

* Add new branch triggers to GitHub workflow

The updated GitHub workflow now includes triggers for branches with 'feat/*', 'enh/*', 'perf/*', 'hotfix/*', and 'chore/*' prefixes. This is to ensure that the workflow runs not only for the main, feature, issue, bug, enhancement, patch, and fix branches, but also on all new branches, improving coverage and visibility on all changes.

* Add FindByIdAsync method to WorkflowInstanceManager

This commit introduces a new method, FindByIdAsync, to the WorkflowInstanceManager service. This method fetches a WorkflowInstance using its Id. Also, an interface declaration for the new method is added to IWorkflowInstanceManager.

* Refactor workflow definitions and add indexTriggers parameter

The code for creating workflow definition filters has been refactored for brevity. Additionally, two sets of overloaded methods named `PopulateStoreAsync` and `AddAsync` were added to "IWorkflowDefinitionStorePopulator" and implemented in "DefaultWorkflowDefinitionStorePopulator". These methods allow specifying whether triggers should be indexed.

* Refactor WorkflowDefinitionActivity code

The refactoring is focused on an improved way of finding and passing ActivityDescriptor within WorkflowDefinitionActivity class. Previously, the service provider was passed to the DeclareInputAsVariables and DeclareOutputAsVariables methods, leading to a less readable and harder to maintain code. Now, we pass the ActivityDescriptor directly, making the code easier to understand and modify.

* Update PolymorphicObjectConverter exception handling

Fixes have been applied to the PolymorphicObjectConverter by adding the handling of TargetException. Additionally, the System.Reflection namespace has been included, and the addSetMethod invocation for the HashSet has been streamlined for better readability and performance.

* Remove unnecessary whitespace in PersistWorkflowExecutionLogMiddleware

This change simply removes an unneeded line of whitespace in the corresponding Middleware file. This change is consistent with the goal of maintaining clean and easy-to-read code.

* Refactor MassTransitWorkflowDispatcher and add new methods

Systematic refactor of the MassTransitWorkflowDispatcher class which initially focused on restructuring the DispatchAsync methods. New methods have been added that deal specifically with triggering and bookmarking workflows thus enhancing the readability of the code while also improving its autonomous function. The logging for non-found workflows has been improved as well.

* Update event handler names in Workflow cache eviction

Evicting the cache prior to triggers being indexed fixes a bug where publishing workflow changes would not result in new triggers being found.

* Update Async calls and mark obsolete messages

The commit adjusts calls to AddAsync in DefaultWorkflowRegistry and DispatchAsync in DefaultWorkflowInbox to improve readability. Also, it marks DispatchResumeWorkflows and DispatchTriggerWorkflows in the Elsa.MassTransit.Messages namespace as obsolete, indicating their pending removal in future releases.

* Refactor workflow dispatch code to a separate method

The changes remove duplication and improve readability by extracting the code responsible for dispatching a workflow into a separate method called DispatchWorkflowAsync. This method creates a workflow instance, gets the send endpoint, and then sends the message.

* Refactor exception handling in PolymorphicObjectConverter

This commit simplifies the two separate catch blocks for NotSupportedException and TargetException into a single block using the new 'or' pattern in C#. It also makes minor adjustments to improve the clarity and readability of the code relating to the 'addSetMethod' invocation.

* Update src/modules/Elsa.MassTransit/Services/MassTransitWorkflowDispatcher.cs

Co-authored-by: raymonddenhaan <155616759+raymonddenhaan@users.noreply.github.com>

* Fix an attempt to dispatch bookmark ID instead of workflow instance ID

The MassTransitWorkflowDispatcher.cs file is updated to improve readability and clarity. This includes changing the way bookmark and trigger filter objects are initialized, by breaking down the single-line initialization into multiple lines. Additionally, some logic has been updated in the DispatchBookmarksAsync function for better handling of workflow instance properties and input merging.

* Add logging to SendHttpRequestBase

The SendHttpRequestBase activity in the Elsa.Http module is updated to utilize the ILogger service. This extension enables the capture of HttpRequestException and TaskCanceledException events and logs their warnings, providing insight into potential issues during HTTP request sending.

---------

Co-authored-by: raymonddenhaan <155616759+raymonddenhaan@users.noreply.github.com>
2024-04-19 01:06:52 +02:00
..
Elsa.Alterations Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.Alterations.Core Fix flowchart completion after faulted child activity cancellation (#5145) 2024-03-29 20:38:09 +01:00
Elsa.Alterations.MassTransit Add alteration notifications and management (#5097) 2024-03-20 10:58:59 +01:00
Elsa.AzureServiceBus Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Caching Fix WorkflowActivity to Use Cached Workflow Definitions for Consistent Behavior (#5223) 2024-04-15 10:06:27 +02:00
Elsa.Caching.Distributed Fix WorkflowActivity to Use Cached Workflow Definitions for Consistent Behavior (#5223) 2024-04-15 10:06:27 +02:00
Elsa.Caching.Distributed.MassTransit Fix WorkflowActivity to Use Cached Workflow Definitions for Consistent Behavior (#5223) 2024-04-15 10:06:27 +02:00
Elsa.Common Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.CSharp Add 'From' methods and mark 'Get' methods as obsolete 2024-02-14 11:39:47 +01:00
Elsa.Dapper Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.Dapper.Migrations Alterations with Queries (#5032) 2024-03-13 20:34:46 +01:00
Elsa.Dsl Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Elasticsearch Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.Email Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.EntityFrameworkCore Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.EntityFrameworkCore.Common Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.EntityFrameworkCore.MySql Regenerate V3.1 EF Core migrations with custom runtime schema support (#5155) 2024-03-29 21:15:23 +01:00
Elsa.EntityFrameworkCore.PostgreSql Regenerate V3.1 EF Core migrations with custom runtime schema support (#5155) 2024-03-29 21:15:23 +01:00
Elsa.EntityFrameworkCore.Sqlite Regenerate V3.1 EF Core migrations with custom runtime schema support (#5155) 2024-03-29 21:15:23 +01:00
Elsa.EntityFrameworkCore.SqlServer Regenerate V3.1 EF Core migrations with custom runtime schema support (#5155) 2024-03-29 21:15:23 +01:00
Elsa.Environments Remove version number from Elsa.Environments project file 2024-02-12 19:11:18 +01:00
Elsa.Expressions Add Unicode encoding support to serializers (#5049) 2024-03-08 14:27:32 +01:00
Elsa.FileStorage #5107 Add framework reference & package removal (#5128) 2024-03-28 21:35:47 +01:00
Elsa.Hangfire Implement dispatch channels (#4949) 2024-02-16 10:56:30 +01:00
Elsa.Hosting.Management Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.Http Optimize Workflow Execution and Messaging (#5243) 2024-04-19 01:06:52 +02:00
Elsa.Identity Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.JavaScript Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.KeyValues Refactor code and update comments for better readability 2024-02-20 11:26:52 +01:00
Elsa.Labels Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Liquid Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.MassTransit Optimize Workflow Execution and Messaging (#5243) 2024-04-19 01:06:52 +02:00
Elsa.MassTransit.AzureServiceBus Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.MassTransit.RabbitMq Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.MongoDb Add caching to workflow runtime and workflow management stores (#5174) 2024-04-10 11:51:40 +02:00
Elsa.ProtoActor Refactor workflow dispatch and instance creation process (#5213) 2024-04-12 10:46:40 +02:00
Elsa.ProtoActor.Cluster.AzureContainerApps Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Python Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Quartz Implement dispatch channels (#4949) 2024-02-16 10:56:30 +01:00
Elsa.Quartz.EntityFrameworkCore.MySql update AppAny package version and fix MySql and SqlServer migration for Quartz (#4921) 2024-02-09 19:38:43 +01:00
Elsa.Quartz.EntityFrameworkCore.PostgreSql update AppAny package version and fix MySql and SqlServer migration for Quartz (#4921) 2024-02-09 19:38:43 +01:00
Elsa.Quartz.EntityFrameworkCore.Sqlite update AppAny package version and fix MySql and SqlServer migration for Quartz (#4921) 2024-02-09 19:38:43 +01:00
Elsa.Quartz.EntityFrameworkCore.SqlServer update AppAny package version and fix MySql and SqlServer migration for Quartz (#4921) 2024-02-09 19:38:43 +01:00
Elsa.SasTokens Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Scheduling Add logging to ScheduledCronTask constructor and setup (#5122) 2024-03-21 19:46:52 +01:00
Elsa.Telnyx #5106 Cleanup packages to leverage framework (#5129) 2024-03-29 09:54:44 +01:00
Elsa.Webhooks Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.WorkflowContexts replace configureawait.props and frameworks.props with Directory.Build.props 2024-01-26 19:04:39 +02:00
Elsa.WorkflowProviders.BlobStorage Convert to use Central Package Management 2024-02-04 13:49:54 +02:00
Elsa.Workflows.Api Minor improvements and bug fixes following the 3.1 release (#5168) 2024-04-02 07:41:46 +02:00
Elsa.Workflows.Core Optimize Workflow Execution and Messaging (#5243) 2024-04-19 01:06:52 +02:00
Elsa.Workflows.Management Optimize Workflow Execution and Messaging (#5243) 2024-04-19 01:06:52 +02:00
Elsa.Workflows.Runtime Optimize Workflow Execution and Messaging (#5243) 2024-04-19 01:06:52 +02:00