Commit graph

1763 commits

Author SHA1 Message Date
Sipke Schoorstra 62df21cbaf Make StringData property nullable in WorkflowDefinition
Updated the `StringData` property to allow null values, improving flexibility and aligning with usage scenarios where the property may not always contain a value. This change ensures better handling of optional data.
2024-12-26 11:52:36 +01:00
Sipke Schoorstra 0992404d96 Add integration test for workflow serialization
Introduce a new integration test to verify workflow serialization functionality, ensuring that newly created workflow definitions can be serialized and deserialized correctly. Adjust default nullability for certain fields in `WorkflowDefinition` to improve consistency and prevent null reference issues. Minor argument update in `New` method of `WorkflowDefinitionPublisher`.
2024-12-26 11:17:54 +01:00
Sipke Schoorstra 76d685744d Update target frameworks and package versions to latest
Dropped .NET 6 support and upgraded projects to .NET 8 and .NET 9 frameworks. Updated several package dependencies to their latest stable or preview versions to ensure compatibility and leverage improvements.
2024-12-22 10:00:56 +01:00
Sipke Schoorstra 621c298126
Merge pull request #6218 from SergerGood/main
Call async methods when in an async method
2024-12-22 08:47:56 +01:00
Sergei Khlebnikov 8583da9b5f
Merge branch 'elsa-workflows:main' into main 2024-12-16 22:58:04 +03:00
sergergood 311b792f9b Call async methods when in an async method 2024-12-16 22:57:11 +03:00
Mathijs Dumon c25ef53dcc Fix for #6082 - dropdowns are not populated for inputs without UIHints 2024-12-16 16:15:58 +01:00
Sipke Schoorstra a1652f3f23 Refactor activity cancellation and bookmark handling.
Added logic to cancel child activities during activity cancellation. Removed redundant bookmark removal logic in the `Fork` activity for better clarity and efficiency.
2024-12-14 21:02:14 +01:00
Sipke Schoorstra 83ccbca0e9
Merge pull request #6211 from Sverre-W/retention-sweep-interval
Retention: Allow to define cleanup strategy for workflow instances
2024-12-14 19:36:29 +01:00
Sverre Winkelmans 6a91eb5130
Allow to define cleanup strategy for workflow instances 2024-12-14 12:19:21 +08:00
Sipke Schoorstra 08f7c2bf78
Merge pull request #6208 from Sverre-W/retention-sweep-interval
Retention: Add sweep interval to feature configuration
2024-12-13 15:18:48 +01:00
Sipke Schoorstra 99d48a8c42
Merge pull request #6210 from elsa-workflows/bug/object-vaiable-parsing
Refactor variable handling in storage driver logic
2024-12-13 15:17:13 +01:00
Sipke Schoorstra b9bde79638 Refactor variable handling in storage driver logic
Refactored `StorageDriverContext` to include `Variable` and updated its usage across relevant methods to ensure context accuracy. Enhanced `ObjectConverter` to support conditional deserialization of JSON objects. Adjusted `WorkflowInstanceStorageDriver` to utilize improved variable resolution with new conversion options.
2024-12-13 12:09:04 +01:00
Marius Vasile Vușcan 49715bb2a7
Fixed issues that the outputs of a background actiity to not be mapped 2024-12-13 12:18:15 +02:00
Sverre Winkelmans 7049872fa9
Add sweep interval to feature configuration
Allow users to define their own sweep interval of the cleanup job in the
Retention module
2024-12-13 10:08:25 +08:00
Sipke Schoorstra 2cd90ad011 Fix logging to display full variable type on parse failure
Updated the log message to use the full variable type name instead of the base type. This provides more detailed context for debugging failed variable parsing issues.
2024-12-12 23:08:48 +01:00
Sipke Schoorstra 9aed23278e Improve error message for invalid variable type cast
Updated the exception message to use the full type name of the variable, providing clearer details for debugging type compatibility issues during variable value parsing.
2024-12-12 23:06:50 +01:00
Sipke Schoorstra b1f839a517 Improve variable parsing with error handling and logging
Added `TryParseValue` method to handle parse errors gracefully and prevent crashes. Updated `VariablePersistenceManager` to log warnings when variable parsing fails, providing better debugging support and resilience during workflow execution.
2024-12-12 23:03:20 +01:00
Sipke Schoorstra c3e5624321 Regenerate 3.3 EF Core migrations for backwards compat with 3.2 2024-12-12 22:24:39 +01:00
Sipke Schoorstra af3b3a0d16 Reset migrations and restore WorkflowInboxMessages DB set for backwards compatibility
Remove unused using directive in migration file

Deleted an unnecessary using statement for improved code clarity and maintainability. This cleanup has no functional impact on the migration.
2024-12-12 19:42:18 +01:00
Sipke Schoorstra 9eeed44fc2
Merge pull request #6205 from elsa-workflows/enh/thread-safe-tenant-service
Add concurrency locks to DefaultTenantService operations
2024-12-12 11:42:34 +01:00
Sipke Schoorstra 2656e83109 Use 'null' instead of 'default' for optional delegate parameter
Replaced 'default' with 'null' to improve clarity and better align with common C# practices for optional parameters. This change makes the code more explicit and easier to understand.
2024-12-12 11:38:22 +01:00
Sipke Schoorstra a9c8ad64f1 Add concurrency locks to DefaultTenantService operations
Introduced SemaphoreSlim for initialization and refresh methods to ensure thread safety in DefaultTenantService. Improved tenant unregistration to handle scope cleanup only when mappings exist. These changes enhance reliability and prevent race conditions during tenant operations.
2024-12-12 11:20:45 +01:00
Marius Vasile Vușcan 687c9d616e
Fixed variable value retrieval 2024-12-12 12:18:32 +02:00
Sipke Schoorstra fa9f83f11f Disable activity state filtering temporarily.
Commented out state filtering logic to address issues with log sanitization. The raw value is now directly stored in the activity state until a redesigned solution is implemented.
2024-12-11 18:11:36 +01:00
Sipke Schoorstra 2af951f6c3 Update display name in WorkflowStorageDriver
Remove the "Deprecated" label from the display name for clarity while keeping the `Obsolete` attribute to indicate planned deprecation. This ensures better alignment between the display name and actual usage guidance.
2024-12-11 16:01:57 +01:00
Marius Vasile Vușcan 95e3b15106
Updated to allow string tags 2024-12-11 16:45:23 +02:00
Marius Vasile Vușcan 16122182e2
Introduce the possibility to exclude variable value retrieval for certain storage drivers 2024-12-11 16:45:18 +02:00
Sipke Schoorstra 96bf791668 Introduce JobKeyProvider for managing Quartz job keys
Added JobKeyProvider to centralize job key and group name handling, simplifying Quartz job scheduling. Refactored QuartzWorkflowScheduler to use the new provider, improving maintainability. Updated QuartzSchedulerFeature to register the new provider and a startup task for job registration.
2024-12-11 14:35:49 +01:00
Sipke Schoorstra 9725be0e0f Fix HTML encoding for ampersand in XML documentation
Replaced '&' with '&' in the XML documentation comment to ensure proper HTML encoding. This change improves compatibility and prevents potential rendering issues in documentation tools.
2024-12-11 14:35:19 +01:00
Sipke Schoorstra 1534d5f29a Merge remote-tracking branch 'origin/main' 2024-12-11 10:59:07 +01:00
Sipke Schoorstra 46793825ec Refactor workflow stores to support ordering by creation date.
Added support for ordering workflow definitions and instances by their creation date when querying. This change replaces manual pagination and filtering logic with streamlined methods that utilize the new `WorkflowDefinitionOrder` and `WorkflowInstanceOrder` objects, improving code clarity and maintainability.
2024-12-11 10:58:50 +01:00
Sipke Schoorstra 04796a0471 Increase default TTL for bookmark queue items to 1 minute.
Updated the default Time-to-Live (TTL) from 10 seconds to 1 minute to allow bookmark queue items to persist longer. This change provides more flexibility and reduces the likelihood of premature purging in workflows.
2024-12-11 10:56:59 +01:00
Sipke Schoorstra 17fd9797e0 Add ActivityTypeName to BookmarkQueueItem mapping
This update includes the ActivityTypeName property in the mapping process for BookmarkQueueItem. It ensures more detailed information is carried during the mapping operation, enhancing traceability and debugging.
2024-12-11 10:56:43 +01:00
Sipke Schoorstra 06b7ba43e5
Merge pull request #6083 from jdevillard/enh/tenants/otel-props
[Feat: OTEL + Tenants] : Add TenantId Property to Span
2024-12-11 10:42:40 +01:00
Sipke Schoorstra 9d00466ef3
Merge pull request #6157 from Suchiman/fixPrimitiveSerialization
Fix Primitive Collection serialization
2024-12-11 08:59:02 +01:00
Sipke Schoorstra 5c86e5aefb
Merge pull request #6192 from Suchiman/fixRaceCondition
Fix C# Script<T> race conditino
2024-12-11 08:51:40 +01:00
Robin Sue 7697b35f47 Add Oracle EFC9 Provider 2024-12-10 21:17:00 +01:00
Robin Sue 4d6b7a17fb Add .NET 9.0 target 2024-12-10 21:06:42 +01:00
Sipke Schoorstra d1ee5c77d0
Persist workflow variables during background execution. (#6195)
Added a call to save workflow variables in the BackgroundActivityInvoker to ensure that any changes are persisted during background activity execution. This helps maintain consistency and state integrity across workflow invocations.
2024-12-09 20:36:20 +01:00
Robin Sue 7f5355a9ed Fix C# Script<T> race conditino
Compilation of the Script wasn't entirely thread safe, specifically, if the same script was being evaluated twice at the same time on an empty cache:
Thread 1: Puts Script<T> into cache, then starts compiling it
Thread 2: Finds not yet compiled Script<T> in cache, starts compiling it as well
Thread 1: Done compiling, Assembly.Load it for running
Thread 2: Done compiling, Assembly.Load it <--- Exception: Assembly with name XYZ already loaded

The Solution is to use CreateDelegate which compiles the script the moment it is being put into the cache and the cache then only serves precompiled delegates that are immediately runnable.
2024-12-08 23:24:46 +01:00
Sipke Schoorstra d164de42f6
Add TenantId to RunTaskWebhookPayload (#6191)
Incorporated the TenantId field into the RunTaskWebhookPayload model and updated the RunTaskHandler to pass this information. This change enables multi-tenant support by including the tenant identifier in webhook payloads.
2024-12-07 20:52:51 +01:00
Sipke Schoorstra 4651b7a46d
Add schema registry support to Kafka module (#6190)
This commit introduces a schema registry functionality by adding interfaces and classes to manage schema registry definitions in the Elsa.Kafka module. It updates KafkaOptions to include schema registries and modifies classes to support schema registry configurations for producers and consumers. Additionally, it updates package references to include necessary dependencies for schema registry support.
2024-12-07 20:07:30 +01:00
Sipke Schoorstra a2448523a9
Fix race condition and add rate limiting to bookmark queue processing (#6187)
* Fix race condition and add rate limiting to bookmark queue processing

Introduce rate-limited function invocation for bookmark queue processing using ThrottleDebounce library to optimize performance. Update related classes and interfaces to support asynchronous and cancellation-aware operations, improving system responsiveness. Adjust logging to provide more detailed information during bookmark queue handling.

* Enable workflows on bug branches

This change updates the GitHub Actions workflow configuration to trigger on branches with the 'bug/*' pattern. This allows for automated actions on bug fix branches alongside the main branch, improving development and testing processes.
2024-12-07 17:34:10 +01:00
Sipke Schoorstra 17a692c058 Update log message + level in RemoveOrphanedSubscriptions to remove unnecessary noise from exception 2024-12-06 18:10:59 +01:00
Sipke Schoorstra ac48e54ab8 Introduce job unscheduling functionality
Add a new method `UnscheduledAsync` to unschedule jobs across various components, including the job queue, background activity scheduler, and Hangfire integration. This enhancement provides a more robust way to remove jobs from scheduling, complementing the existing cancellation functionality.

This fixes an issue where a background activity execution job that resumed a workflow, which in turn would remove any associated bookmarks, which in turn would cancel the background job while that job is still executing and has to e.g. persist changes made to the DB.
2024-12-05 19:25:16 +01:00
Sipke Schoorstra 75cb3a3de2
Add synthetic properties to JS engine for exclusion (#6178)
* Add synthetic properties to JS engine for exclusion

This fixes an issue where inputs would be declared as new variables, causing a "miss" when trying to read the input.

* Add InputOutput workflows and tests for data exchange

Introduce new Consumer and Provider JSON workflows to facilitate testing of input and output functionalities, ensuring seamless data exchange between processes. Implement corresponding tests to verify the correct reception and transmission of input data within the Provider workflow back to the Consumer, validating the setup with an assertion for expected output. Update the project configuration to include these workflows in the build output.
2024-12-05 09:30:31 +01:00
Robin Sue 3bc1cc3ae6 Undo putting _type first for now 2024-12-04 15:47:02 +01:00
Robin Sue c4a6ce2796 Fix Primitive Collection serialization
This was broken by both #5871 and #5682:
1. When a List<Guid> was serialized, it was recognized as a primitive collection and thus plainly written to the JSON without any type information: ["d4d8404c-4357-47ff-a343-649a116539f5"]
2. When this JSON was deserialized, due to lack of type info, it was deserialized as List<object>, containing strings. This is already not good.
3. When this List<object> gets serialized again (e.g. due to multiple workflow suspends causing WorkflowState serialization), this time it fails the primitive collection recognition, because object is not a primitive type. It now gets serialized as {"_items": ["d4d8404c-4357-47ff-a343-649a116539f5"], "_type": "Object[]"}
4. When that JSON gets deserialized, it tries to ReadType() but ReadType() fails to parse Object[] since it lacks the logic from TypeJsonConverter to throw away the [] before looking up Object in the WellKnownTypeRegistry, so it returns null as a type. Without a type but being faced with a json object { ... } it now deserializes into an ExpandoObject
5. Any further serialization / deserializations will now cause the expando object to get nested deeper and deeper every time.
2024-12-04 15:47:01 +01:00
Sipke Schoorstra 97b59974d9
Refactor and reorganize Workflow Storage modules. (#6177)
Moved WorkflowStorageDriver and WorkflowInstanceStorageDriver to a new namespace, VariableStorageDrivers, to improve organization. Updated namespaces in related services and ensured backward compatibility with comments. Minor fix made to TypeJsonConverter for consistency and additional configuration adjustments to support the new structure.
2024-12-04 15:32:40 +01:00