Skip to main content

Iterator

Iterates through data collections with controlled pacing for asynchronous operations.

component image

In-ports

input <any> — Data collection to iterate through. Non-arrays are treated as single-element arrays.

next <any> — Triggers emission of the next element in the iteration.

Out-ports

begin Array — Emits collection to be processed when iteration starts.

output <any> — Current element from the input collection.

end Object — Emits status object when iteration completes or reset for the current input.

Overview

The Iterator component provides controlled iteration through data collections, allowing asynchronous operations between each element. Unlike automatic iteration, this component waits for explicit signals to advance to the next element.

The component processes data in a predictable sequence. When new collection arrives, it first emits it on begin port to indicate iteration start. Each element is then emitted on the output port only when triggered by the next port. After all elements are processed, a {status: "COMPLETED"} object is emitted on end port to signal the completion.

The Iterator supports reset functionality through the RESET signal on the input port (RESET signals on next port are ignored). When a RESET signal arrives, the component:

  • Clears the current buffer of queued collections on input port
  • Removes remaining items from the current collection
  • Waits for the current item to complete processing (awaits an event on next port)
  • Emits a status object {status: "INTERRUPTED", reason: "RESET"} on the end port
  • Immediately forwards the RESET signal

This controlled flow enables complex processing patterns where each element requires time-consuming operations like API calls, database queries, or user interactions. The component automatically queues multiple inputs and processes them sequentially to maintain order and prevent resource conflicts.

Settings

No additional configuration is required.

Error Handling

Input errors are ignored to prevent iteration interruption.