Size Buffer
The Size Buffer stage is used to accumulate a max number of events and then emit all the events as an array. This is helpful in examples where you’re sampling source data at a high frequency but the target system is more efficient when processing chunks at a time.
Window Size
Number of values to accumulate into the buffer before emitting the values to the next stage(s).
Timeout
In some cases you may want to accumulate N events or emit after Y period of time. Setting the Timeout will emit the buffer after Y period of time if it hasn’t already hit the Window Size. Every time the buffer emits the Timeout is reset. When set to zero, there is no timeout.
Window Expression
The Window Expression allows for creating separate buffers given a unique key in the value or metadata. For example, you could create a buffer per Instance name or Model type.
Setting the key is controlled using JavaScript and the stage.setBufferKey
function. stage.setBufferKey(null)
is the default, and creates a single buffer. stage.setBufferKey(event.name)
creates a unique buffer per source name (i.e. input or instance name). Each unique buffer has its own Window Size and Timeout.