- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
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 createPricesStep,9 attachProductToSalesChannelStep10} from "./steps"11 12interface WorkflowInput {13 title: string14}15 16const myWorkflow = createWorkflow(17 "my-workflow",18 (input: WorkflowInput) => {19 const product = createProductStep(input)20 21 const [prices, productSalesChannel] = parallelize(22 createPricesStep(product),23 attachProductToSalesChannelStep(product)24 )25 26 return new WorkflowResponse({27 prices,28 productSalesChannel29 })30 }31)
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?