What is difference between Run on Background and Run as Asynchronous in vFlow 2.0
In vFlow 2.0, the terms “Run on Background” and “Run as Asynchronous” refer to different methods of executing tasks, but they have specific use cases and behavior differences. Here’s a breakdown of each:
-
Run on Background is used to execute tasks in the background without interrupting the main workflow.
-When a task is set to “Run on Background,” the task is initiated and allowed to run while the workflow continues executing other tasks. The main workflow doesn’t wait for the background task to finish before proceeding to the next step.-It is typically used for tasks that do not need to block the flow. For example, if you need to send an email or log data to an external service, you can set that to run in the background while the rest of the workflow progresses.
-The task runs separately from the main flow, and the workflow moves forward immediately after starting the background task, without waiting for it to complete.
-
Run as Asynchronous also allows for parallel execution but with a stronger focus on handling the result of the task once it’s completed asynchronously.
-When a task is marked as Asynchronous the workflow does not wait for the task to complete to move on to the next task. However, you can set up the workflow to handle the result of the asynchronous task later, when it’s finished.
-This is used when you need to perform an action that will eventually produce a result, but you don’t need that result immediately. A common use case would be calling an API that processes data and returns a result after some time. The workflow can move on without waiting for the response, but you can set up a mechanism to handle the response once it arrives (like using a callback or checking the result later).
-Like “Run on Background,” this task will execute independently. However, the key difference is that the asynchronous execution model allows for more structured handling of its result or output.