Building DataFlow Applications : Building DataFlow Applications in Java : Composing an Application : Connecting Operator Ports
 
Share this page                  
Connecting Operator Ports
Each operator has input and/or output port(s). To create a functional application, the output port(s) of operators must be connected to the input port(s) of the other operators until the required graph is produced.
Operators may have optional input ports and are not required to be connected. All required input ports must be connected. Otherwise, it issues a compile time exception.
Use the LogicalGraph instance to connect two ports. Ports are always connected from the source (output port) to the target (input port).
In the above example, the following code connects the ports of the GenerateRandom and LogRows instances.
// Connect the output of the generator to the input of the logger graph.connect(generator.getOutput(), logger.getInput());
The method getOutput() is used to get the output port of the GenerateRandom instance. Similarly, the getInput() method is used to get the input port of the LogRows instance.
A few operators may support multiple inputs or multiple outputs. For information about determining the getter methods for the input and output ports of the operator, see the JavaDoc of each operator.