# while

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: while
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: processors/while
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: processors/while.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/processors/while.adoc
page-git-created-date: "2024-05-24"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/connect/components/processors/while.md -->

**Available in:** [Cloud](https://docs.redpanda.com/cloud-data-platform/develop/connect/components/processors/while/%20%22View%20the%20Cloud%20version%20of%20this%20component%22), Self-Managed

A processor that checks a [Bloblang query](https://docs.redpanda.com/connect/guides/bloblang/about/) against each batch of messages and executes child processors on them for as long as the query resolves to true.

#### Common

```yml
processors:
  label: ""
  while:
    at_least_once: false
    check: ""
    processors: [] # No default (required)
```

#### Advanced

```yml
processors:
  label: ""
  while:
    at_least_once: false
    max_loops: 0
    check: ""
    processors: [] # No default (required)
```

The field `at_least_once`, if true, ensures that the child processors are always executed at least one time (like a do .. while loop.)

The field `max_loops`, if greater than zero, caps the number of loops for a message batch to this value.

If following a loop execution the number of messages in a batch is reduced to zero the loop is exited regardless of the condition result. If following a loop execution there are more than 1 message batches the query is checked against the first batch only.

The conditions of this processor are applied across entire message batches. You can find out more about batching [in this doc](https://docs.redpanda.com/connect/configuration/batching/).

## [](#fields)Fields

### [](#at_least_once)`at_least_once`

Whether to always run the child processors at least one time.

**Type**: `bool`

**Default**: `false`

### [](#check)`check`

A [Bloblang query](https://docs.redpanda.com/connect/guides/bloblang/about/) that should return a boolean value indicating whether the while loop should execute again.

**Type**: `string`

**Default**: `""`

```yaml
# Examples:
check: errored()

# ---

check: this.urls.unprocessed.length() > 0
```

### [](#max_loops)`max_loops`

An optional maximum number of loops to execute. Helps protect against accidentally creating infinite loops.

**Type**: `int`

**Default**: `0`

### [](#processors)`processors[]`

A list of child processors to execute on each loop.

**Type**: `processor`