use of com.github.ashvina.common.TopologyArgParser in project streaming-samples by ashvina.
the class NoAckWordCount2StageTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new RandomWordSpout(), parser.get(SPOUT));
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPOUT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setEnableAcking(false);
conf.setNumStmgrs(parser.getNumWorkers());
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
use of com.github.ashvina.common.TopologyArgParser in project streaming-samples by ashvina.
the class TopTrendingTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, COUNTER, PARTIAL, TOTAL);
TweetSpout tweetSpout = new TweetSpout("/tmp/tweets.txt");
RollingCountBolt countBolt = new RollingCountBolt(Duration.ofSeconds(10), Duration.ofMillis(500));
PartialRanker partialRanker = new PartialRanker(Duration.ofSeconds(5), 5);
TotalRanker totalRanker = new TotalRanker(Duration.ofSeconds(5), 5);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, tweetSpout, parser.get(SPOUT));
builder.setBolt(COUNTER, countBolt, parser.get(COUNTER)).fieldsGrouping(SPOUT, new Fields(FIELD_TREND));
builder.setBolt(PARTIAL, partialRanker, parser.get(PARTIAL)).fieldsGrouping(COUNTER, new Fields(FIELD_TREND));
builder.setBolt(TOTAL, totalRanker, parser.get(TOTAL)).globalGrouping(PARTIAL);
Config conf = new Config();
conf.setDebug(false);
conf.setEnableAcking(false);
conf.setNumStmgrs(parser.getNumWorkers());
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
use of com.github.ashvina.common.TopologyArgParser in project streaming-samples by ashvina.
the class NoAckWordCount2StageTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new AckingRandomWordSpout(), parser.get(SPOUT));
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPOUT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setNumWorkers(parser.getNumWorkers());
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
use of com.github.ashvina.common.TopologyArgParser in project streaming-samples by ashvina.
the class AckingWordCount2StageTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new AckingRandomWordSpout(), parser.get(SPOUT));
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPOUT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setNumStmgrs(parser.getNumWorkers());
conf.setEnableAcking(true);
conf.setMaxSpoutPending(Integer.MAX_VALUE);
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
use of com.github.ashvina.common.TopologyArgParser in project streaming-samples by ashvina.
the class AckingWordCountTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, SPLIT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new AckingRandomSentenceSpout(), parser.get(SPOUT));
builder.setBolt(SPLIT, new SplitSentence(), parser.get(SPLIT)).shuffleGrouping(SPOUT);
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPLIT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setNumWorkers(parser.getNumWorkers());
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
Aggregations