Skip to main content

Take While

Emits events while the given KelpQL expression predicate is truthy.

component image

In-ports

input <any> — input events.

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

Out-ports

output <any> — output events.

Overview

The Take While operator emits events from the input stream while the given KelpQL expression predicate applied to incoming events is truthy. Afterward, the operator stops applying the predicate and stops emitting subsequent events.

By default, the predicate expression is @ , which means any event will be matched and therefore emitted.

Example 1

This example applies the Take While operator to a stream of integer values. The expression @ < 4 is used to take only the first three events.

take while example 1

Settings

Enable realtime config port

If this setting is enabled, the component can be configured through the config port. This port accepts a configuration object as input and allows you to set dynamic properties at runtime. Note that using this port does not cause the component to reinitialize, but it may cause some previous state of the component to be lost.

Expression (expr)

KelpQL expression that will be used as a predicate. Default expression is @.

Type: String
Default: @
Required: Yes

Configuration object

Here is an example of a configuration object that you can use as a template:

{
"expr": "@ > 2"
}