use of org.apache.heron.api.tuple.Fields in project heron by twitter.
the class LocalReadWriteTopology method main.
public static void main(String[] args) throws Exception {
if (args.length < 3 || args.length > 4) {
throw new RuntimeException("Expects 3 or 4 arguments, topology name, " + "inputFile, outputFile and max emit count (optional)");
}
String topologyName = args[0];
String inputFile = args[1];
String outputFile = args[2];
TestTopologyBuilder builder = new TestTopologyBuilder(outputFile);
builder.setTerminalBoltClass(LOCAL_AGGREGATOR_BOLT_CLASS);
if (args.length == 3) {
builder.setSpout("paused-local-spout", new PausedLocalFileSpout(inputFile), 1);
} else {
int maxEmits = Integer.parseInt(args[3]);
builder.setSpout("paused-local-spout", new PausedLocalFileSpout(inputFile), 1, maxEmits);
}
builder.setBolt("identity-bolt", new IdentityBolt(new Fields("line")), 1).shuffleGrouping("paused-local-spout");
Config conf = new BasicConfig();
HeronSubmitter.submitTopology(topologyName, conf, builder.createTopology());
}
use of org.apache.heron.api.tuple.Fields in project heron by twitter.
the class StatefulWindowingTest method buildTopology.
@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
builder.setSpout("sentence", new RandomSentenceSpout(), 1);
builder.setBolt("split", new SplitBolt(), 1).shuffleGrouping("sentence");
builder.setBolt("consumer", new ConsumerBolt().withWindow(BaseWindowedBolt.Count.of(10), BaseWindowedBolt.Count.of(10)), 1).fieldsGrouping("split", new Fields("word"));
return builder;
}
use of org.apache.heron.api.tuple.Fields in project heron by twitter.
the class BasicTopologyOneTask method buildTopology.
@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
builder.setSpout("ab-spout", new ABSpout(true), 1);
builder.setBolt("identity-bolt", new IdentityBolt(new Fields("word")), 2).shuffleGrouping("ab-spout");
return builder;
}
use of org.apache.heron.api.tuple.Fields in project heron by twitter.
the class FieldsGrouping method buildTopology.
@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
builder.setSpout("ab-spout", new ABSpout(), 1, 400);
builder.setBolt("count-bolt", new WordCountBolt(), 2).fieldsGrouping("ab-spout", new Fields("word"));
builder.setBolt("sum-bolt", new CountAggregatorBolt(), 1).noneGrouping("count-bolt");
return builder;
}
use of org.apache.heron.api.tuple.Fields in project heron by twitter.
the class OneSpoutMultiTasks method buildTopology.
@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder builder) {
builder.setSpout("ab-spout", new ABSpout(), 3);
builder.setBolt("identity-bolt", new IdentityBolt(new Fields("word")), 1).shuffleGrouping("ab-spout");
return builder;
}
Aggregations