Search in sources :

Example 1 with TopologyArgParser

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());
}
Also used : TopologyArgParser(com.github.ashvina.common.TopologyArgParser) Fields(com.twitter.heron.api.tuple.Fields) TopologyBuilder(com.twitter.heron.api.topology.TopologyBuilder) Config(com.twitter.heron.api.Config)

Example 2 with TopologyArgParser

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());
}
Also used : TopologyArgParser(com.github.ashvina.common.TopologyArgParser) Fields(com.twitter.heron.api.tuple.Fields) TopologyBuilder(com.twitter.heron.api.topology.TopologyBuilder) Config(com.twitter.heron.api.Config)

Example 3 with TopologyArgParser

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());
}
Also used : TopologyArgParser(com.github.ashvina.common.TopologyArgParser) Fields(org.apache.storm.tuple.Fields) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) Config(org.apache.storm.Config)

Example 4 with TopologyArgParser

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());
}
Also used : TopologyArgParser(com.github.ashvina.common.TopologyArgParser) Fields(com.twitter.heron.api.tuple.Fields) TopologyBuilder(com.twitter.heron.api.topology.TopologyBuilder) Config(com.twitter.heron.api.Config)

Example 5 with TopologyArgParser

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());
}
Also used : TopologyArgParser(com.github.ashvina.common.TopologyArgParser) Fields(org.apache.storm.tuple.Fields) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) Config(org.apache.storm.Config)

Aggregations

TopologyArgParser (com.github.ashvina.common.TopologyArgParser)9 Config (com.twitter.heron.api.Config)5 TopologyBuilder (com.twitter.heron.api.topology.TopologyBuilder)5 Fields (com.twitter.heron.api.tuple.Fields)5 Config (org.apache.storm.Config)4 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)4 Fields (org.apache.storm.tuple.Fields)4