Generating final punctuation

In general, primitive operators generate final punctuation when they have no input ports and have an exit condition.

Source operators usually have no input ports and sometimes have an exit condition. An example of a source operator from the SPL Standard Toolkit is the FileSource operator. When this operator is not provided with an optional input stream, it reads tuples from a single file and submits them downstream. This operator has two different exit conditions. The first is if there is a shutdown request (for example, triggered by a job cancellation). The second is when the operator finishes processing the file. When either of these conditions are met, the operator has no work that is left to do. The operator thread ends and a final punctuation marker is automatically generated by the Teracloud® Streams instance. Since all operator threads return, the operator does not need to explicitly send the final marker to its output port.

When the FileSource operator has input ports, it does not generate final punctuation. Since tuples are received asynchronously, the operator does not know when it is going to get the next tuple. In general, operators with input ports rarely generate final punctuation themselves. They instead forward or drop punctuation that is received from upstream operators (automatically taken care of by the Teracloud® Streams instance).