Search in sources :

Example 1 with ConsoleOutputOperator

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);
}
Also used : SiteToSiteClient(org.apache.nifi.remote.client.SiteToSiteClient) ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) SiteToSiteClientConfig(org.apache.nifi.remote.client.SiteToSiteClientConfig) NiFiSinglePortInputOperator(org.apache.apex.malhar.contrib.nifi.NiFiSinglePortInputOperator) WindowDataManager(org.apache.apex.malhar.lib.wal.WindowDataManager)

Example 2 with ConsoleOutputOperator

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));
}
Also used : ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) TimeBasedDedupOperator(org.apache.apex.malhar.lib.dedup.TimeBasedDedupOperator)

Example 3 with ConsoleOutputOperator

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);
}
Also used : ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) Counter(org.apache.apex.malhar.lib.stream.Counter) KeyValPair(org.apache.apex.malhar.lib.util.KeyValPair)

Example 4 with ConsoleOutputOperator

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;
}
Also used : ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) Operator(com.datatorrent.api.Operator) FunctionOperator(org.apache.apex.malhar.lib.function.FunctionOperator) ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator)

Example 5 with ConsoleOutputOperator

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;
}
Also used : ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) Operator(com.datatorrent.api.Operator) FunctionOperator(org.apache.apex.malhar.lib.function.FunctionOperator) ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator)

Aggregations

ConsoleOutputOperator (org.apache.apex.malhar.lib.io.ConsoleOutputOperator)36 RandomEventGenerator (org.apache.apex.malhar.lib.testbench.RandomEventGenerator)6 Operator (com.datatorrent.api.Operator)5 Counter (org.apache.apex.malhar.lib.stream.Counter)5 PubSubWebSocketAppDataQuery (org.apache.apex.malhar.lib.io.PubSubWebSocketAppDataQuery)4 PubSubWebSocketAppDataResult (org.apache.apex.malhar.lib.io.PubSubWebSocketAppDataResult)4 WindowOption (org.apache.apex.malhar.lib.window.WindowOption)4 URI (java.net.URI)3 UniqueCounter (org.apache.apex.malhar.lib.algo.UniqueCounter)3 AppDataSnapshotServerMap (org.apache.apex.malhar.lib.appdata.snapshot.AppDataSnapshotServerMap)3 MapToKeyHashValuePairConverter (org.apache.apex.malhar.lib.converter.MapToKeyHashValuePairConverter)3 WindowState (org.apache.apex.malhar.lib.window.WindowState)3 List (java.util.List)2 FunctionOperator (org.apache.apex.malhar.lib.function.FunctionOperator)2 ApacheLogParseMapOutputOperator (org.apache.apex.malhar.lib.logs.ApacheLogParseMapOutputOperator)2 DimensionObject (org.apache.apex.malhar.lib.logs.DimensionObject)2 JsonByteArrayOperator (org.apache.apex.malhar.lib.stream.JsonByteArrayOperator)2 KeyValPair (org.apache.apex.malhar.lib.util.KeyValPair)2 FSWindowDataManager (org.apache.apex.malhar.lib.wal.FSWindowDataManager)2 TriggerOption (org.apache.apex.malhar.lib.window.TriggerOption)2