How Can I Call a Custom Component Asynchronously in a Workflow?

This topic was automatically generated from Slack. You can find the original thread here.

I have created a custom action which is a bit slow and takes some time to execute. I want to create a workflow in which I can call that component asynchronously. How can I do that ?

To execute a custom action asynchronously within a Pipedream workflow, you can’t directly call the action in a non-blocking way since each step in a Pipedream workflow waits for the previous step to complete before moving on to the next. However, you can use various flow control mechanisms to manage the execution of slower actions. One approach is to use the built-in Delay actions to pause the workflow for a certain amount of time before or after your custom action. This doesn’t make the call to the custom action asynchronous, but it allows you to manage the timing of your workflow’s execution. Here’s how you can add a delay: 1. Click the + button below any step. 2. Search for the Delay app. 3. Select the Delay Workflow action. 4. Configure the action to delay for the amount of time you expect the custom action to take. Please note that this method is suitable if you have an estimate of how long the custom action takes to execute and you want to ensure that the workflow does not proceed before the action is completed. If you’re looking to truly run actions in parallel or manage more complex asynchronous behavior, you might need to consider breaking up your workflow into multiple workflows and using Pipedream’s built-in HTTP actions to trigger another workflow once your slow action completes. For more detailed guidance on flow control, including delays, you can refer to the Pipedream documentation on flow control.

The other option is to queue it on another workflow. So then this action is executed totally asynchronously.

You can use subscriptions to trigger this async workflow, or an HTTP trigger. Or a background job service like QStash

Got it, Thanks . let me try that.