use of org.apache.apex.malhar.lib.io.ConsoleOutputOperator in project apex-malhar by apache.
the class Application method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration configuration) {
RandomNumberPairGenerator inputOperator = new RandomNumberPairGenerator();
WindowedOperatorImpl<MutablePair<Double, Double>, MutablePair<MutableLong, MutableLong>, Double> windowedOperator = new WindowedOperatorImpl<>();
Accumulation<MutablePair<Double, Double>, MutablePair<MutableLong, MutableLong>, Double> piAccumulation = new PiAccumulation();
windowedOperator.setAccumulation(piAccumulation);
windowedOperator.setDataStorage(new InMemoryWindowedStorage<MutablePair<MutableLong, MutableLong>>());
windowedOperator.setWindowStateStorage(new InMemoryWindowedStorage<WindowState>());
windowedOperator.setWindowOption(new WindowOption.GlobalWindow());
windowedOperator.setTriggerOption(TriggerOption.AtWatermark().withEarlyFiringsAtEvery(Duration.millis(1000)).accumulatingFiredPanes());
ConsoleOutputOperator outputOperator = new ConsoleOutputOperator();
dag.addOperator("inputOperator", inputOperator);
dag.addOperator("windowedOperator", windowedOperator);
dag.addOperator("outputOperator", outputOperator);
dag.addStream("input_windowed", inputOperator.output, windowedOperator.input);
dag.addStream("windowed_output", windowedOperator.output, outputOperator.input);
}
use of org.apache.apex.malhar.lib.io.ConsoleOutputOperator in project apex-malhar by apache.
the class ApexStreamImpl method print.
@Override
@SuppressWarnings("unchecked")
public ApexStreamImpl<T> print() {
ConsoleOutputOperator consoleOutputOperator = new ConsoleOutputOperator();
addOperator(consoleOutputOperator, (Operator.InputPort<T>) consoleOutputOperator.input, null, Option.Options.name(IDGenerator.generateOperatorIDWithUUID(consoleOutputOperator.getClass())));
return this;
}
use of org.apache.apex.malhar.lib.io.ConsoleOutputOperator in project apex-malhar by apache.
the class ApexStreamImpl method print.
@Override
@SuppressWarnings("unchecked")
public ApexStreamImpl<T> print(Option... opts) {
ConsoleOutputOperator consoleOutputOperator = new ConsoleOutputOperator();
addOperator(consoleOutputOperator, (Operator.InputPort<T>) consoleOutputOperator.input, null, opts);
return this;
}
use of org.apache.apex.malhar.lib.io.ConsoleOutputOperator in project apex-malhar by apache.
the class WindowedMergeOperatorTestApplication method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
WindowedMergeOperatorImpl<Integer, Integer, List<Set<Integer>>, List<List<Integer>>> op = dag.addOperator("Merge", new WindowedMergeOperatorImpl<Integer, Integer, List<Set<Integer>>, List<List<Integer>>>());
op.setAccumulation(new CoGroup<Integer>());
op.setDataStorage(new InMemoryWindowedStorage<List<Set<Integer>>>());
op.setRetractionStorage(new InMemoryWindowedStorage<List<List<Integer>>>());
op.setWindowStateStorage(windowStateMap);
// Can select one of the following window options, or don't select any of them.
// op.setWindowOption(new WindowOption.GlobalWindow());
op.setWindowOption(new WindowOption.TimeWindows(Duration.millis(2000)));
op.setTriggerOption(new TriggerOption().withEarlyFiringsAtEvery(1).accumulatingFiredPanes());
op.setAllowedLateness(Duration.millis(500));
NumGen1 numGen1 = dag.addOperator("numGen1", new NumGen1());
NumGen2 numGen2 = dag.addOperator("numGen2", new NumGen2());
Collector collector = dag.addOperator("collector", new Collector());
ConsoleOutputOperator con = dag.addOperator("console", new ConsoleOutputOperator());
dag.addStream("num1", numGen1.output, op.input);
dag.addStream("num2", numGen2.output, op.input2);
dag.addStream("wm1", numGen1.watermarkDefaultOutputPort, op.controlInput);
dag.addStream("wm2", numGen2.watermarkDefaultOutputPort, op.controlInput2);
dag.addStream("MergedResult", op.output, collector.input);
dag.addStream("output", collector.output, con.input);
}
use of org.apache.apex.malhar.lib.io.ConsoleOutputOperator in project apex-malhar by apache.
the class Application method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration configuration) {
WordGenerator inputOperator = new WordGenerator();
KeyedWindowedOperatorImpl<String, Long, MutableLong, Long> windowedOperator = new KeyedWindowedOperatorImpl<>();
Accumulation<Long, MutableLong, Long> sum = new SumAccumulation();
windowedOperator.setAccumulation(sum);
windowedOperator.setDataStorage(new InMemoryWindowedKeyedStorage<String, MutableLong>());
windowedOperator.setRetractionStorage(new InMemoryWindowedKeyedStorage<String, Long>());
windowedOperator.setWindowStateStorage(new InMemoryWindowedStorage<WindowState>());
windowedOperator.setWindowOption(new WindowOption.TimeWindows(Duration.standardMinutes(1)));
windowedOperator.setTriggerOption(TriggerOption.AtWatermark().withEarlyFiringsAtEvery(Duration.millis(1000)).accumulatingAndRetractingFiredPanes());
// windowedOperator.setAllowedLateness(Duration.millis(14000));
ConsoleOutputOperator outputOperator = new ConsoleOutputOperator();
dag.addOperator("inputOperator", inputOperator);
dag.addOperator("windowedOperator", windowedOperator);
dag.addOperator("outputOperator", outputOperator);
dag.addStream("input_windowed", inputOperator.output, windowedOperator.input);
dag.addStream("windowed_output", windowedOperator.output, outputOperator.input);
}
Aggregations