use of com.twitter.heron.examples.api.bolt.SlidingWindowSumBolt in project incubator-heron by apache.
the class SlidingWindowTopology method main.
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("integer", new RandomIntegerSpout(), 1);
builder.setBolt("slidingsum", new SlidingWindowSumBolt().withWindow(BaseWindowedBolt.Count.of(30), BaseWindowedBolt.Count.of(10)), 1).shuffleGrouping("integer");
builder.setBolt("tumblingavg", new TumblingWindowAvgBolt().withTumblingWindow(BaseWindowedBolt.Count.of(3)), 1).shuffleGrouping("slidingsum");
builder.setBolt("printer", new PrinterBolt(), 1).shuffleGrouping("tumblingavg");
Config conf = new Config();
conf.setDebug(true);
String topoName = "test";
conf.setComponentRam("integer", ByteAmount.fromGigabytes(1));
conf.setComponentRam("slidingsum", ByteAmount.fromGigabytes(1));
conf.setComponentRam("tumblingavg", ByteAmount.fromGigabytes(1));
conf.setComponentRam("printer", ByteAmount.fromGigabytes(1));
conf.setContainerDiskRequested(ByteAmount.fromGigabytes(5));
conf.setContainerCpuRequested(4);
if (args != null && args.length > 0) {
topoName = args[0];
}
HeronSubmitter.submitTopology(topoName, conf, builder.createTopology());
}
Aggregations