use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.
the class RandomEventGeneratorApp method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
RandomEventGenerator random = dag.addOperator("random", new RandomEventGenerator());
DevNull<Integer> dev1 = dag.addOperator("dev1", new DevNull());
DevNull<String> dev2 = dag.addOperator("dev2", new DevNull());
dag.addStream("random1", random.integer_data, dev1.data).setLocality(locality);
dag.addStream("random2", random.string_data, dev2.data).setLocality(locality);
}
use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.
the class RubyOperatorBenchmarkApplication method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
rand.setMaxvalue(3000);
rand.setTuplesBlast(120);
RandomMapOutput randMap = dag.addOperator("randMap", new RandomMapOutput());
randMap.setKey("val");
RubyOperator ruby = dag.addOperator("ruby", new RubyOperator());
String setupScript = "def square(val)\n";
setupScript += " return val*val\nend\n";
ruby.addSetupScript(setupScript);
ruby.setInvoke("square");
ruby.setPassThru(true);
ConsoleOutputOperator console = dag.addOperator("console", new ConsoleOutputOperator());
dag.getMeta(console).getMeta(console.input).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.getMeta(ruby).getMeta(ruby.result).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("rand_randMap", rand.integer_data, randMap.input).setLocality(Locality.THREAD_LOCAL);
dag.addStream("randMap_ruby", randMap.map_data, ruby.inBindings).setLocality(locality);
dag.addStream("ruby_console", ruby.result, console.input).setLocality(locality);
}
use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.
the class CassandraOutputBenchmarkApplication method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
int maxValue = 1000;
RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
rand.setMinvalue(0);
rand.setMaxvalue(maxValue);
rand.setTuplesBlast(200);
CassandraOutputOperator cassandra = dag.addOperator("cassandra", new CassandraOutputOperator());
CassandraTransactionalStore store = new CassandraTransactionalStore();
store.setKeyspace("test");
store.setNode("127.0.0.1");
cassandra.setStore(store);
dag.addStream("rand_cassandra", rand.integer_data, cassandra.input).setLocality(locality);
}
use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.
the class TestNiFiOutputApplication method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
final SiteToSiteClientConfig clientConfig = new SiteToSiteClient.Builder().url("http://localhost:8080/nifi").portName("Apex").buildConfig();
final int batchSize = 1;
final SiteToSiteClient.Builder builder = new SiteToSiteClient.Builder().fromConfig(clientConfig);
final NiFiDataPacketBuilder<String> dataPacketBuilder = new StringNiFiDataPacketBuilder();
final WindowDataManager windowDataManager = new WindowDataManager.NoopWindowDataManager();
RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
NiFiSinglePortOutputOperator nifi = dag.addOperator("nifi", new NiFiSinglePortOutputOperator(builder, dataPacketBuilder, windowDataManager, batchSize));
dag.addStream("rand_nifi", rand.string_data, nifi.inputPort).setLocality(null);
}
use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.
the class CouchBaseAppOutput method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
int maxValue = 1000;
RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
rand.setMinvalue(0);
rand.setMaxvalue(maxValue);
rand.setTuplesBlast(200);
CouchBaseOutputOperator couchbaseOutput = dag.addOperator("couchbaseOutput", new CouchBaseOutputOperator());
// couchbaseOutput.getStore().setBucket("default");
// couchbaseOutput.getStore().setPassword("");
dag.addStream("ss", rand.integer_data, couchbaseOutput.input).setLocality(locality);
}
Aggregations