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.
This PR adds the ability for activities to execute asynchronously, which means, in the background without blocking workflow execution of other activities.
This enables scenarios where you have for example two branches that each execute an activity that then execute in the background in parallel.
Before this PR, one would have to create an activity that does the following:
After this PR, we can now simply write an activity and configure its Kind to be either Job or Task.
When configured as Job, the activity will always execute in the background.
When configured as Task, the activity will execute in the foreground by default, but allows the user to configure the activity to run in the background instead.
As an example, the SendHttpRequest activity has its Kind set to Task, allowing users of this activity to either execute the activity in the foreground or in the background.
When running the activity in the foreground, the workflow engine cannot run other activities. This means that even if you have a fork with e.g. 3 branches, each branch performing an HTTP request that takes e.g. 2 seconds, it would take a total of 6 seconds for all branches to complete.
But when you run the activities in the background, they can execute in parallel, allowing the fork to finish in 2 seconds.