Skip to content

Gather ​

Second half of the scatter-gather pattern: waits for the results of all branches started by a Scatter component and emits them as one combined object. The output type is generated from the components connected to its input.

Pins ​

PinKindTypesDescription
InputinputanyConnect the last component of every scatter branch here (one connection per branch).
Outputoutputgenerated type <flow namespace>.<OutputName>One object per scattered message, with one property per input connection.

Configuration ​

FieldTypeDefaultDescription
OutputNameidentifier (required)emptyName of the output type created in the flow, e.g. ProductInfo. Changing it (re)generates the type.

Behaviour ​

  • Output type: when OutputName is set, the component creates (or updates) a flow type named OutputName in the flow namespace. For every input connection it adds a property named after the source component (sanitized to an identifier), typed with the type of that connection, e.g. PriceService : PriceResponse, StockService : StockRecord. Properties of removed connections are dropped; existing properties keep their name when a component is renamed.
  • Each incoming message must carry Scatter metadata. The message is stored in its slot; when the last slot of that scattered message is filled, one object of the output type is emitted with every property set to the result from its branch. The metadata of the last arriving branch is passed on.
  • Until then nothing is emitted. If the Scatter timeout has already expired, incoming results are ignored (Scatter reports the timeout).

Notes ​

  • Connect all branches before setting OutputName; the type can't be created without input connections. After adding, removing or retyping a branch, set OutputName again (re-save) to regenerate the type - otherwise the flow fails with "cannot find property owned by the component ...".
  • The flow fails at start if the output type doesn't exist (no OutputName set).
  • A message that did not pass through a Scatter component raises "The metaData is missing Scatter value".
  • Each branch must deliver exactly one message per scattered input, otherwise the result is never emitted (see Scatter).
  • A branch result must be of the type on its connection (or a wrapper of it); other types raise "Don't know how to convert ...".

Example ​

json
{ "OutputName": "ProductInfo" }

Scatter → (Http client "PriceService", Database reader "StockService") → Gather → Json serializer → Http response

Viaducta documentation