Interface MultiOutputIterator<T>

Type Parameters:
T - the record type

public interface MultiOutputIterator<T>
Allows a processor to stream records lazily to multiple output connections without buffering, supporting two mutually exclusive modes per invocation:
  • Split mode (setIterator(Iterator)): a single tagged iterator routes each record to a specific output connection via TaggedOutput. Use when records come from one shared source and must be split between outputs.
  • Independent mode (setIterator(String, Iterator)): each output connection gets its own independent lazy iterator, consumed in parallel by the drain loop. Use when each output has its own self-contained lazy source.

Both modes can be selected at runtime from the same fixed method parameter, so the component does not need separate parameters per output.

It is equally valid to use it with a single output: the point is then to stream records lazily instead of pushing them through an OutputEmitter, which avoids buffering. In that case the branch is named as usual with @Output("FLOW"); @Output(branches = ...) is only needed when the parameter feeds several branches, to declare them to the design layer.

Important: This interface is supported only in the Studio DI runtime.

Split mode example (one source, per-record routing):

 
 
 &#64;ElementListener
 public void process(&#64;Input Record input,
         &#64;Output(branches = { "MAIN", "REJECT" }) MultiOutputIterator<Record> out) {
     out.setIterator(
             mySource.stream()
                     .map(r -> isValid(r)
                             ? TaggedOutput.of("MAIN", transform(r))
                             : TaggedOutput.of("REJECT", r))
                     .iterator());
 }
 
 

Independent mode example (each output has its own lazy source):

 
 
 &#64;AfterGroup
 public void afterGroup(&#64;Output(branches = { "MAIN", "REJECT" }) MultiOutputIterator<Record> out) {
     out.setIterator("MAIN", mainDatabase.lazyQuery());
     out.setIterator("REJECT", errorLog.lazyRead());
 }
 
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setIterator(String outputName, Iterator<T> iterator)
    Independent mode: assigns a lazy iterator to a specific named output connection.
    void
    Split mode: sets a single lazy iterator whose elements are tagged with the target output connection name via TaggedOutput.
  • Method Details

    • setIterator

      void setIterator(Iterator<TaggedOutput<T>> iterator)
      Split mode: sets a single lazy iterator whose elements are tagged with the target output connection name via TaggedOutput. The runtime reads one record at a time and routes it to the matching connection.

      Mutually exclusive with setIterator(String, Iterator) within one invocation.

      Parameters:
      iterator - the tagged iterator routing records to their named outputs
    • setIterator

      void setIterator(String outputName, Iterator<T> iterator)
      Independent mode: assigns a lazy iterator to a specific named output connection. Call once per output that needs a dedicated lazy source; connections without an assigned iterator fall back to the push-mode queue as usual.

      Mutually exclusive with setIterator(Iterator) within one invocation.

      Parameters:
      outputName - the output connection name (e.g. "MAIN", "REJECT")
      iterator - the lazy iterator producing records for that connection