Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor workflow dispatch and instance creation process #5213

Merged
merged 6 commits into from
Apr 12, 2024
Merged

Conversation

sfmskywalker
Copy link
Member

@sfmskywalker sfmskywalker commented Apr 11, 2024

This update splits the process of dispatching a workflow into two steps: Initialization and Execution. Now, first, a new workflow instance is created and saved with the input parameters. Second, the new workflow instance is dispatched for execution. This process ensures that the size of the message dispatched does not exceed acceptable limits and enhances workflow dispatch efficiency. It also helps avoid data loss in case of premature process termination or failure in the initial stages of execution.

Closes #5031

This update splits the process of dispatching a workflow into two steps: Initialization and Execution. Now, first, a new workflow instance is created and saved with the input parameters. Second, the new workflow instance is dispatched for execution. This process ensures that the size of the message dispatched does not exceed acceptable limits and enhances workflow dispatch efficiency. It also helps avoid data loss in case of premature process termination or failure in the initial stages of execution.
The code changes involve modifying the default WorkflowSubStatus from 'Executing' to 'Pending'. This minor adjustment is implemented to represent a more accurate initial state of a new workflow instance in the WorkflowManagement module in Elsa.
The change extends the WorkflowInstance grain to include an IWorkflowInstanceStore to support workflows that already exist. Additionally, the CreateWorkflowHostAsync method is enhanced to rebuild a workflow host if the instance already exists.
Removed unnecessary comment tags in the `StartWorkflowHostParams` class for better readability and simplicity. Also, unused lines of code from the `IWorkflowRuntime` interface have been commented out to enhance clarity and cleanliness in the codebase.
@sfmskywalker sfmskywalker marked this pull request as ready for review April 11, 2024 16:52
@sfmskywalker sfmskywalker requested review from a team April 11, 2024 16:53
@elsa-workflows elsa-workflows deleted a comment from sonarcloud bot Apr 11, 2024
The obsolete comment about attaching a version header to the message was removed from 'MassTransitWorkflowDispatcher.cs'. This comment was no longer relevant as the dispatcher no longer performs the action described.
@sfmskywalker sfmskywalker merged commit 9f55e83 into main Apr 12, 2024
3 checks passed
@sfmskywalker sfmskywalker deleted the issue/5031 branch April 12, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor IWorkflowDispatcher to Avoid Large Message Exceptions
3 participants