use of org.apache.heron.examples.api.bolt.PrinterBolt in project heron by twitter.
the class StatefulSlidingWindowTopology method main.
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("integer", new IntegerSpout(), 1);
builder.setBolt("sumbolt", new WindowSumBolt().withWindow(BaseWindowedBolt.Count.of(5), BaseWindowedBolt.Count.of(3)), 1).shuffleGrouping("integer");
builder.setBolt("printer", new PrinterBolt()).shuffleGrouping("sumbolt");
Config conf = new Config();
conf.setDebug(true);
String topoName = "test";
Config.setComponentRam(conf, "integer", ByteAmount.fromGigabytes(1));
Config.setComponentRam(conf, "sumbolt", ByteAmount.fromGigabytes(1));
Config.setComponentRam(conf, "printer", ByteAmount.fromGigabytes(1));
Config.setContainerDiskRequested(conf, ByteAmount.fromGigabytes(5));
Config.setContainerCpuRequested(conf, 4);
conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE);
conf.setTopologyStatefulCheckpointIntervalSecs(20);
conf.setMaxSpoutPending(1000);
if (args != null && args.length > 0) {
topoName = args[0];
}
HeronSubmitter.submitTopology(topoName, conf, builder.createTopology());
}
use of org.apache.heron.examples.api.bolt.PrinterBolt in project heron by twitter.
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());
}
use of org.apache.heron.examples.api.bolt.PrinterBolt in project heron by twitter.
the class StatefulTumblingWindowTopology method main.
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("integer", new IntegerSpout(), 1);
WindowSumBolt windowSumBolt = new WindowSumBolt();
windowSumBolt.withTumblingWindow(Duration.ofMinutes(10));
builder.setBolt("sumbolt", windowSumBolt, 1).shuffleGrouping("integer");
builder.setBolt("printer", new PrinterBolt()).shuffleGrouping("sumbolt");
Config conf = new Config();
conf.setDebug(true);
String topoName = "test";
Config.setComponentRam(conf, "integer", ByteAmount.fromGigabytes(1));
Config.setComponentRam(conf, "sumbolt", ByteAmount.fromGigabytes(1));
Config.setComponentRam(conf, "printer", ByteAmount.fromGigabytes(1));
Config.setContainerDiskRequested(conf, ByteAmount.fromGigabytes(5));
Config.setContainerCpuRequested(conf, 4);
conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE);
conf.setTopologyStatefulCheckpointIntervalSecs(20);
conf.setMaxSpoutPending(1000);
conf.setMessageTimeoutSecs(1500);
if (args != null && args.length > 0) {
topoName = args[0];
}
HeronSubmitter.submitTopology(topoName, conf, builder.createTopology());
}
Aggregations