Mux/Demux Items

A multiplexer (mux) or demultiplexer (demux) item. These items delimit a demux/mux pipeline. Items between a demux item and a mux item are all templates (defined in more detail here) and are executed as many times as the demux item creates separate outputs.

Let's consider an example. The ResultSet to byte stream supporting demux item takes a result set as input, and creates a separate byte stream as output. There is a separate byte stream per row in the result set. The implementor specifies how the byte stream is to be generated by implementing (in a JSR-233 compliant scripting language that their system supports) this function:

public abstract void transformRow(ResultSet resultSet, OutputStream outputStream);

This, as you probably guessed, is the definition of the function in Java. The idea is that this function will be called once per row in the result set. The implementor of this function can read all the columns available in the result set and write whatever they want in the output stream passed as argument. Each time this function is called the implementor will be writing to a different output stream. This is all handled behind the scenes by the demux item.