Break
The break component is used to interrupt iteration inside a for node. When the message passes through this node, it writes an interrupt flag into the message metadata. The for node detects this flag and immediately stops iteration.
# Configuration
This component has no configuration fields.
# How It Works
It sets metadata['_break']='1' and the for node checks this flag after each iteration. Once detected, the for node clears the flag and stops iterating.
# Relation Type
- Success: Always forwards to
Successso the upstreamfornode can continue its control flow (including break detection). - Failure: None.
# Execution Result
Does not modify msg or msgType; only writes the interrupt flag _break=1 in metadata.
# Configuration Example
The following example interrupts iteration when a condition is met:
{
"ruleChain": { "id": "break-01", "name": "Break in For Loop", "debugMode": true, "root": true },
"metadata": {
"nodes": [
{ "id": "n_for", "type": "for", "name": "iterate", "configuration": { "range": "msg.items", "do": "n_check", "mode": 1 } },
{ "id": "n_check", "type": "switch", "name": "cond", "configuration": { "cases": [ { "case": "msg.value>50", "then": "Stop" } ] } },
{ "id": "n_break", "type": "break", "name": "break" }
],
"connections": [
{ "fromId": "n_check", "toId": "n_break", "type": "Stop" },
{ "fromId": "n_for", "toId": "n_check", "type": "Success" }
]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
Edit this page on GitHub (opens new window)
Last Updated: 2025/11/27, 10:15:33