dispatch

Dispatch the flowdata to the target nodes.

Description

  • Dispatch the flowdata to the flows of target nodes.

  • The target nodes can be called either sequentially or concurrently.

  • The flowdata is shared in sequential mode.

  • The flowdata is finally merged and passed to the child node in concurrent mode.

  • When the flows of the target nodes are finished, then run children of dispatch node.

Parameters

Parameter

Type

Required

Default

Comment

mode

str

No

concurrent

Set either of sequential or concurrent.

targets

list(node)

No

None

Target nodes to dispatch the flowdata.

Examples

# Dispatch the flowdata sequentially
# Output: {'msg': 10, 'target1': 11, 'target2': 21, 'target3': 31}
- message:
    name: "msg"
    msg: 10
- dispatch:
    name: "dispatch"
    mode: "sequential"
- message:
    name: "target1"
    msg: "{{ fd.msg + 1 }}"
    parent: "dispatch.targets"
- message:
    name: "target2"
    msg: "{{ fd.msg + fd.target1 }}"
    parent: "dispatch.targets"
- message:
    name: "target3"
    msg: "{{ fd.msg + fd.target2 }}"
    parent: "dispatch.targets"

# Dispatch the flowdata concurrently
# Output: {'msg': 10, 'target1': 11, 'target2': 12, 'target3': 13}
- message:
    name: "msg"
    msg: 10
- dispatch:
    name: "dispatch"
    mode: "concurrent"
- message:
    name: "target1"
    msg: "{{ fd.msg + 1 }}"
    parent: "dispatch.targets"
- message:
    name: "target2"
    msg: "{{ fd.msg + 2 }}"
    parent: "dispatch.targets"
- message:
    name: "target3"
    msg: "{{ fd.msg + 3 }}"
    parent: "dispatch.targets"