Support sub-workflow dependency handling of JSON workflows #4098
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGE
This PR adds a new column called
ProviderName
to theWorkflowDefinition
entity.Migrations of the Management module have been replaced that include this column.
When you maintain your own migrations, you should generate an "update" step, or recreate them if you don't mind deleting your database first.
Details
This PR updates the workflow provider system with support for handling workflows that use other workflows as activities.
Before this PR, there would be an issue if you had e.g. two workflow files called Main and Sub, where Sub is configured as "usable as activity" and Main has an activity reference to Sub.
Problem 1: when the system populates the activity registry, it would not see the Sub workflow, since it isn't part of the workflow store at that time.
Problem 2: when the system populates the workflow store from JSON files, and the Main workflow would be encountered before Sub, the Main workflow's activity reference to Sub would be replaced with a NotFoundActivity.
To solve this, the workflows from providers are loaded twice, using the following steps:
One potential concern is that the larger the number of workflows, the longer it takes for the application to startup.
As a future optimisation, we could provide "discovery" data while loading e.g. JSON files to see if any yielded workflows contain NotFoundActivity references from certain providers, and reload only these providers and update the activity registry for just those providers.
Note that workflows created in the DB directly (e.g. via the workflow designer) are not affected by this, since they already exist there and there is no workflow provider that reads from this database (the point of workflow providers is to discover workflows from other sources and store them in the DB).
cc @MariusVuscanNx @cristinamudura