- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
parallelize - Workflows SDK Reference
This documentation provides a reference to the parallelize
. It belongs to the Workflows SDK.
This function is used to run multiple steps in parallel. The result of each step will be returned as part of the result array.
Example#
1import {2 createWorkflow,3 parallelize,4 WorkflowResponse5} from "@medusajs/framework/workflows-sdk"6import {7 createProductStep,8 getProductStep,9 createPricesStep,10 attachProductToSalesChannelStep11} from "./steps"12 13interface WorkflowInput {14 title: string15}16 17const myWorkflow = createWorkflow(18 "my-workflow",19 (input: WorkflowInput) => {20 const product = createProductStep(input)21 22 const [prices, productSalesChannel] = parallelize(23 createPricesStep(product),24 attachProductToSalesChannelStep(product)25 )26 27 const id = product.id28 return new WorkflowResponse(getProductStep(product.id))29 }30)
Type Parameters#
The type of the expected result.
Parameters#
steps
TResultReturns#
TResult
TResultThe step results. The results are ordered in the array by the order they're passed in the function's parameter.
Was this page helpful?