IBM Streams 4.2

Example 7: Replicated sources

In this example of user-defined parallelism, no operators from outside the parallel region are fused with the operators in the parallel region. The parallel region has no incoming streams.

The parallel transformation replicates operators Src and A. No splitters are necessary since there is no stream feeding the parallel region. Fusion places each sibling of operators Src and A from each channel in their own PEs. Fusion places the Snk operator in its own PE.

Since the Src operator has been replicated, if you want to divide the data that each Src operator handles, you must invoke the Src operators in a way that divides the data.
composite Comp7(output A) {
  graph
    stream<Type> Src = Source() {}
    stream<Type> A   = Functor(Src) {}
}

composite Main7 {
  graph
    @parallel(width=2)
    stream<Type> Out = Comp7() {
      config placement: partitionColocation(byChannel());
    }

    () as Snk = Sink(Out) {
      config placement: partitionIsolation;
    }
}

The Logical and Physical stream graphs for Example 7.

Note that, depending on the fusion mode, explicit colocation only guarantees that operators which are specified to be colocated will be colocated, but not necessarily isolated from other operators. In this example, operators from different channels within the parallel region could be placed in the same PE.