use of org.apache.apex.malhar.lib.io.ConsoleOutputOperator in project apex-malhar by apache.
the class TestNiFiInputApplication method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
final SiteToSiteClientConfig clientConfig = new SiteToSiteClient.Builder().url("http://localhost:8080/nifi").portName("Apex").requestBatchCount(5).buildConfig();
final SiteToSiteClient.Builder builder = new SiteToSiteClient.Builder().fromConfig(clientConfig);
final WindowDataManager windowDataManager = new WindowDataManager.NoopWindowDataManager();
NiFiSinglePortInputOperator nifi = dag.addOperator("nifi", new NiFiSinglePortInputOperator(builder, windowDataManager));
ConsoleOutputOperator console = dag.addOperator("console", new ConsoleOutputOperator());
dag.addStream("nifi_console", nifi.outputPort, console.input).setLocality(null);
}
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 conf) {
// Test Data Generator Operator
RandomDataGeneratorOperator gen = dag.addOperator("RandomGenerator", new RandomDataGeneratorOperator());
// Dedup Operator. Configuration through resources/META-INF/properties.xml
TimeBasedDedupOperator dedup = dag.addOperator("Deduper", new TimeBasedDedupOperator());
// Console output operator for unique tuples
ConsoleOutputOperator consoleUnique = dag.addOperator("ConsoleUnique", new ConsoleOutputOperator());
// Console output operator for duplicate tuples
ConsoleOutputOperator consoleDuplicate = dag.addOperator("ConsoleDuplicate", new ConsoleOutputOperator());
// Console output operator for duplicate tuples
ConsoleOutputOperator consoleExpired = dag.addOperator("ConsoleExpired", new ConsoleOutputOperator());
// Streams
dag.addStream("Generator to Dedup", gen.output, dedup.input);
// Connect Dedup unique to Console
dag.addStream("Dedup Unique to Console", dedup.unique, consoleUnique.input);
// Connect Dedup duplicate to Console
dag.addStream("Dedup Duplicate to Console", dedup.duplicate, consoleDuplicate.input);
// Connect Dedup expired to Console
dag.addStream("Dedup Expired to Console", dedup.expired, consoleExpired.input);
// Set Attribute TUPLE_CLASS for supplying schema information to the port
dag.setInputPortAttribute(dedup.input, Context.PortContext.TUPLE_CLASS, TestEvent.class);
// Uncomment the following line to create multiple partitions for Dedup operator. In this case: 2
// dag.setAttribute(dedup, Context.OperatorContext.PARTITIONER, new StatelessPartitioner<TimeBasedDedupOperator>(2));
}
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 conf) {
RandomKeyValGenerator randGen = dag.addOperator("RandomGenerator", new RandomKeyValGenerator());
UniqueValueCount<Integer> valCount = dag.addOperator("UniqueCounter", new UniqueValueCount<Integer>());
ConsoleOutputOperator consOut = dag.addOperator("Console", new ConsoleOutputOperator());
StreamDuplicater<KeyValPair<Integer, Integer>> dup = dag.addOperator("Duplicator", new StreamDuplicater<KeyValPair<Integer, Integer>>());
CountVerifier verifier = dag.addOperator("Verifier", new CountVerifier());
ConsoleOutputOperator successOutput = dag.addOperator("Success", new ConsoleOutputOperator());
successOutput.setStringFormat("Success %d");
ConsoleOutputOperator failureOutput = dag.addOperator("Failure", new ConsoleOutputOperator());
failureOutput.setStringFormat("Failure %d");
Counter successcounter = dag.addOperator("SuccessCounter", new Counter());
Counter failurecounter = dag.addOperator("FailureCounter", new Counter());
dag.addStream("Events", randGen.outport, valCount.input);
dag.addStream("Duplicates", valCount.output, dup.data);
dag.addStream("Unverified", dup.out1, verifier.recIn);
dag.addStream("EventCount", randGen.verport, verifier.trueIn);
dag.addStream("Verified", verifier.successPort, successcounter.input);
dag.addStream("Failed", verifier.failurePort, failurecounter.input);
dag.addStream("SuccessCount", successcounter.output, successOutput.input);
dag.addStream("FailedCount", failurecounter.output, failureOutput.input);
dag.addStream("Output", dup.out2, consOut.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(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 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;
}
Aggregations