use of org.apache.apex.malhar.lib.testbench.SeedEventGenerator in project apex-malhar by apache.
the class Application method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
// Sample DAG with 2 operators
// Replace this code with the DAG you want to build
SeedEventGenerator seedGen = dag.addOperator("seedGen", SeedEventGenerator.class);
seedGen.setSeedStart(1);
seedGen.setSeedEnd(10);
seedGen.addKeyData("x", 0, 10);
seedGen.addKeyData("y", 0, 100);
ConsoleOutputOperator cons = dag.addOperator("console", new ConsoleOutputOperator());
cons.setStringFormat("hello: %s");
dag.addStream("seeddata", seedGen.val_list, cons.input).setLocality(Locality.CONTAINER_LOCAL);
}
use of org.apache.apex.malhar.lib.testbench.SeedEventGenerator in project apex-malhar by apache.
the class SeedEventGeneratorApp method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
SeedEventGenerator seedEvent = dag.addOperator("seedEvent", new SeedEventGenerator());
seedEvent.addKeyData("x", 0, 9);
seedEvent.addKeyData("y", 0, 9);
seedEvent.addKeyData("gender", 0, 1);
seedEvent.addKeyData("age", 10, 19);
DevNull<HashMap<String, String>> devString = dag.addOperator("devString", new DevNull<HashMap<String, String>>());
DevNull<HashMap<String, ArrayList<KeyValPair>>> devKeyVal = dag.addOperator("devKeyVal", new DevNull());
DevNull<HashMap<String, String>> devVal = dag.addOperator("devVal", new DevNull<HashMap<String, String>>());
DevNull<HashMap<String, ArrayList<Integer>>> devList = dag.addOperator("devList", new DevNull());
dag.getMeta(seedEvent).getMeta(seedEvent.string_data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorString", seedEvent.string_data, devString.data).setLocality(locality);
dag.getMeta(seedEvent).getMeta(seedEvent.keyvalpair_list).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorKeyVal", seedEvent.keyvalpair_list, devKeyVal.data).setLocality(locality);
dag.getMeta(seedEvent).getMeta(seedEvent.val_data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorVal", seedEvent.val_data, devVal.data).setLocality(locality);
dag.getMeta(seedEvent).getMeta(seedEvent.val_list).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorValList", seedEvent.val_list, devList.data).setLocality(locality);
}
Aggregations