Example 9: Import operator as the source in a parallel region

In this example of user-defined parallelism, the source is an Import operator rather than a typical Source operator.

This example is similar to Example 8. However, the source is an Import operator. The parallel transformation replicates the A operator and its Import port. Fusion places the A operator siblings for each channel in their own PE.
composite Comp9(output A) {
  graph
    stream<Type> Src = Import() {
    param applicationName: "appName";
          streamId: "published";
          filter: attr == getChannel();
    }
    stream<Type> A = Functor(Src) {}
}

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

  () as Snk = Sink(Out) {}
}

The Logical and Physical stream graphs with a legacy fusion scheme for Example 9.

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.