IBM Streams 4.2

Composite operators and consistent regions

When the @consistent annotation is applied to a composite operator, the annotation indicates that the composite operator and the reachability graph of the composite operator participate in a single consistent region. All the primitive operators inside the composite operator and their reachability graphs form a single consistent region even if they do not form a connected subgraph.
The reachability graph of a composite operator is computed from primitive operators that are automatically identified by the compiler as start operators of a consistent region. A primitive operator is identified as the start of a consistent region if it fulfills one of the following conditions:
  • An operator that has no input streams, for example, a source operator
  • An operator in which all its input stream connections originate from outside of the enclosing annotated composite. Such an operator must be able to replay its output stream. If it is not, include a ReplayableStart operator as the start operator. Remember, however, that applications that use a ReplayableStart operator cannot be deployed to an instance with fewer than four host resources.
As the consistent region is computed based on the reachability graphs of all the start operators in the composite, the consistent region can cross the boundaries of the annotated composite. Therefore, any operator that consumes an output stream from an annotated composite is in the consistent region.

The following figures show several examples on how consistent regions are computed when the @consistent annotation is applied to composite operators.

One composite operator with one consistent region

The following figure shows an example of an SPL graph that is annotated with @consistent. In this example, the whole composite, which is indicated by the box, is annotated with @consistent. The figure shows the same pattern on all the operators that are in the consistent region. All the operators that are inside the composite belong to the same consistent region. The compiler automatically identified op1 and op7 as the start operators of the consistent region, which are indicated with the label, start. From the two start operators, the compiler computes their reachability graph. The compiler identifies op6, op9, and op10 as the end operators of the consistent region, which are indicated with the label, end. All the end operators are sink operators.

Figure 1. Disconnected subgraphs within one consistent region
Graphic showing composite operator that includes several primitive operators.

Composite operator with disconnected subgraphs

The following figure shows an example of a composite operator (shown with the box) with the @consistent annotation. In this example, the composite operator contains two disconnected subgraphs: the subgraph with op1 through op5 and op6 and the subgraph with op7 through op9. Because the annotation is applied on the composite operator, both subgraphs are in the same consistent region.

Figure 2. One composite operator with disconnected subgraphs form a single consistent region
Graphic showing composite operator that includes several primitive operators.

Multiple composite operators with one consistent region

The following figure shows an example where the @consistent annotation is placed on two composite operators. The reachability graph of both composite operators contains op15, which results in a single consistent region.

Figure 3. Merging composite operators into one consistent region
Graphic showing 3 composite operators that includes several primitive operators.