Run in Parallel / Fork Action

The action module for this action is "vb/action/builtin/forkAction".

This action allows multiple action chain paths to run in parallel, then wait for their responses and produce a combined result. Normally, if you do not care what your action chains return, you can chain multiple action chains on the event handler. If you want to wait for the result, and take action once everything is complete, you can use this action instead. 

A fork action has an arbitrary set of actions whose action sub-chains will run in parallel. A special outcome, 'join', will be followed once all the sub-chains complete processing. The outcome of the fork action is always 'join', and the result is a mapping from the outcome id's of the sub-chains to their outcome/result payload.

This action takes one parameter, "actions", which is a map of an action alias, to an Action ID in the chain. The alias is the property name used in the results of the Fork action results (an alias allows the same Action to be called multiple times in the same Fork Action).

Example 1-45 Example

To make two REST calls, then do some assignments only after they both complete:

"myActionChains": {
  "root": "myAction",
  "actions": {
  "myForkAction": {
    "module": "vb/action/builtin/forkAction",
    "parameters": {
      "orcl": "orcl",
      "crm": "crm",
    },
    "outcomes": {
      "join": "join"
    },
  "orcl": {
    "module": "vb/action/builtin/restAction",
    "parameters": {
      "endpoint": "stock/get-stock-quote",
      "uriParams": { "stock": "ORCL" }
    }
  }
  "crm": {
    "module": "vb/action/builtin/restAction",
    "parameters": {
      "endpoint": "stock/get-stock-quote",
      "uriParams": { "stock": "CRM" }
     }
   },
   "join": {
      "module": "vb/action/builtin/assignVariablesAction",
      "parameters": {
        "$page.variables.orcl": { "source": "{{ '' + $chain.results.getAllStockQuotes.orcl.result.body }}" },
        "$page.variables.crm": { "source": "{{ '' + $chain.results.getAllStockQuotes.crm.result.body }}" }
      }
    }
  }
}