Skip to main content

Combine By

Combines multiple input streams and emits a single result on demand (flush or peek) as both array and object forms, with metadata.

stream_combine_by component image

In-ports

p1 … pN <any> — dynamic data inputs; the number of inputs is defined by Port count attribute.

config JSON (dynamic) — accepts a JSON object with configuration properties that can be set at runtime.

flush <any> — provokes emitting of a combined value using current buffers according to the selected mode, flushing them.

peek <any> — provokes emitting of a combined value using current buffers according to the selected mode without flushing buffered data.

Out-ports

array Array — combined values in port order.

object Object — combined values keyed by port labels (or port names when labels are not set).

meta Object — metadata for each emission: request, isFlush, attributes, config, and per-port stat (bufferedEventsCount, bufferedSignalsCount, state, and original port name).

Overview

The Combine By operator buffers values per input and emits a combined result only when triggered by flush or peek.

Usage

  • Connect inputs p1 … pN and send values.
  • Send any event to peek to preview the combined result without updating buffers.
  • Send any event to flush to emit and consume buffered data according to the selected mode.
  • Labels: If port labels are set, object keys and meta.stat keys use labels. meta.stat.[…].name field always contains the original port name.

Modes

  • last — use the latest value per connected input.
  • first — use the first value per connected input since the last flush.
  • all — use all buffered values per input (arrays).

Inputs

  • Connected: Inputs reported as connected are reflected in meta.stat with state: connected. If an input is connected but hasn’t provided a value yet, it is still included in the output:
    • last / first modes: the value is null.
    • all mode: the value is an empty array [].
  • Disconnected: Inputs not reported as connected are reflected in meta.stat with state: disconnected and do not contribute data.

Flush vs Peek

  • flush: emits combined data as defined by the mode and updates/clears buffers.
  • peek: emits combined data as defined by the mode without updating buffers.

Example 1

The following diagram demonstrates the Combine By operator with a mode set to last.

combine by example 1 mode last

Example 2

The following diagram demonstrates the Combine By operator with a mode set to first.

combine by example 1 mode first

Example 3

The following diagram demonstrates the Combine By operator with a mode set to all.

combine by example 1 mode all

Settings

Enable realtime config port (useConfigPort)

When enabled, this setting allows the component to be configured via the config port. The port accepts a configuration object as input, enabling dynamic property updates during runtime. While using this port won't trigger component reinitialization, it may result in the loss of some previous component state.

Port count (portCount)

Defines how many dynamic input ports (p1 … pN) are available.

  • Required: Yes
  • Default: 2

Mode (mode)

How to combine buffered values across inputs.

  • Required: Yes
  • Values: last, first, all
  • Default: last

Configuration object

When the realtime config port is enabled:

{
"mode": "last"
}