• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IntermediateRankingsBolt类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中storm.starter.bolt.IntermediateRankingsBolt的典型用法代码示例。如果您正苦于以下问题:Java IntermediateRankingsBolt类的具体用法?Java IntermediateRankingsBolt怎么用?Java IntermediateRankingsBolt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IntermediateRankingsBolt类属于storm.starter.bolt包,在下文中一共展示了IntermediateRankingsBolt类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: wireTopology

点赞 2

import storm.starter.bolt.IntermediateRankingsBolt; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
  String spoutId = "wordGenerator";
  String counterId = "counter";
  String intermediateRankerId = "intermediateRanker";
  String totalRankerId = "finalRanker";
  builder.setSpout(spoutId, new TestWordSpout(), 5);
  builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).fieldsGrouping(spoutId, new Fields("word"));
  builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(counterId, new Fields(
      "obj"));
  builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
 

开发者ID:luozhaoyu,
项目名称:big-data-system,
代码行数:12,
代码来源:RollingTopWords.java

示例2: wireTopology

点赞 2

import storm.starter.bolt.IntermediateRankingsBolt; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
    String spoutId = "wordGenerator";
    String counterId = "counter";
    String intermediateRankerId = "intermediateRanker";
    String totalRankerId = "finalRanker";
    builder.setSpout(spoutId, new TestWordSpout(), 5);
    builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).fieldsGrouping(spoutId, new Fields("word"));
    builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(counterId,
        new Fields("obj"));
    builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
 

开发者ID:adarshms,
项目名称:sentweet,
代码行数:12,
代码来源:RollingTopWords.java

示例3: wireTopology

点赞 2

import storm.starter.bolt.IntermediateRankingsBolt; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
    builder.setSpout("twitterSpout", new TwitterSampleSpout());
    builder.setBolt("extractHashTags", new ExtractHashTagsBolt(), 8).setNumTasks(32).shuffleGrouping("twitterSpout");
    builder.setBolt("counter", new RollingCountBolt(300, 5), 8).setNumTasks(32).fieldsGrouping("extractHashTags", new Fields("hashtag"));
    builder.setBolt("intermediateRanker", new IntermediateRankingsBolt(TOP_N), 2).setNumTasks(8).fieldsGrouping("counter", new Fields("obj"));
    builder.setBolt("finalRanker", new TotalRankingsBolt(TOP_N, 5)).globalGrouping("intermediateRanker");
    builder.setBolt("rankPoster", new PostRankingsBolt()).shuffleGrouping("finalRanker");
}
 

开发者ID:adarshms,
项目名称:sentweet,
代码行数:9,
代码来源:SentweetTopology.java

示例4: wireTopology

点赞 2

import storm.starter.bolt.IntermediateRankingsBolt; //导入依赖的package包/类
private void wireTopology() throws InterruptedException {
    builder.setSpout("twitterSpout", new TwitterSampleSpout());
    builder.setBolt("extractHashTags", new ExtractHashTagsBolt(), 2).shuffleGrouping("twitterSpout");
    builder.setBolt("counter", new RollingCountBolt(300, 5), 4).fieldsGrouping("extractHashTags", new Fields("hashtag"));
    builder.setBolt("intermediateRanker", new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping("counter", new Fields("obj"));
    builder.setBolt("finalRanker", new TotalRankingsBolt(TOP_N, 5)).globalGrouping("intermediateRanker");
    builder.setBolt("rankPoster", new PostRankingsBolt()).shuffleGrouping("finalRanker");
}
 

开发者ID:adarshms,
项目名称:sentweet,
代码行数:9,
代码来源:SentweetLocal.java

示例5: main

点赞 2

import storm.starter.bolt.IntermediateRankingsBolt; //导入依赖的package包/类
public static void main(String[] args) {
        String consumerKey = "42NRnxnkuqrghnolDWSqbiFyv"; 
        String consumerSecret = "zmwC0g6z1FOBBQigW8w2lrnLYncuH4p3QX25RUCNa8aU1QSCC5"; 
        String accessToken = "2809571326-fyBz1ITFXf4yjuqZvHKgGyy0QcQfNVr8y2OGYq6"; 
        String accessTokenSecret = "MAnEtUccHXheXf0z2pauV75oj2XOm6ag4hiLvbUOh6n6B";
        int interval = 2000;
        
        String[] keyWords = new String[]{"cat", "car", "Stockholm", "snow", "data", "system", "Trump", "Palantir", "blue", "badger",
        		"NFL", "apple", "google", "facebook", "perks", "spg", "cajun", "banana", "taco", "whatever", "weareone", "packers", "green",
        		"NBA", "mlb", "dog", "kitten", "blueberry", "romance", "princess", "phone", "nuts", "sheldon", "mad", "talk", "nasty",
        		"procrastination", "cook", "college", "patriots", "dumnass", "dough", "winter", "game", "thrones", "halloween", "warcraft",
        		"hiking", "intern", "park", "sweater", "epic", "dota", "year", "wrath", "waste", "Blake", "street", "toyota", "arrow", 
        		"warning", "travel", "flight", "reject", "karaoke", "bless", "empire", "survivor", "bank", "dating", "restaurant", "tinder",
        		"shopping", "win", "cold", "recap", "cop", "astronaut", "crime", "book", "http", "injured", "china", "awards", "join", 
        		"ugly", "birthday", "friend", "weather", "shirt", "student", "mail", "sleep", "pet", "sea", "dream", "chritmas", "thanksgiving",
        		"vacation", "california", "church", "love", "fuck", "vote", "election", "bernie", "parade", "disney", "today", "city",
        		"marathon", "trade", "cash", "miles", "fun", "work", "free", "photo", "hard", "water", "god", "speech", "gang", "bear", 
        		"stop", "luck", "vegas", "shame", "food", "fool", "weight", "football", "tennis", "concert", "cancer", "stock", "crazy",
        		"ticket", "play", "project", "russia", "cast", "star", "trailer", "yelp", "video", "hawaii", "law", "rage", "comic", "meme",
        		"swag", "snack", "drink", "alcohol", "peace", "swift", "maroon", "xbox", "surface", "flower", "sport", "music", "traffic", "family",
        		"autograph", "selfie", "fans"}; 
        
        TopologyBuilder builder = new TopologyBuilder();
        
        builder.setSpout("friendsCount", new Q2RandomFriendsCountSpout(interval));
        builder.setSpout("hashtags", new Q2RandomHashtagSpout(interval, 100));
        builder.setSpout("tweets", new Q2SeqTwitterSpout(consumerKey, consumerSecret, accessToken, accessTokenSecret, keyWords));
        builder.setBolt("join1", new SingleJoinBolt(new Fields("seq", "friendsCount", "hashtags")))
        	.fieldsGrouping("friendsCount", new Fields("seq"))
        	.fieldsGrouping("hashtags", new Fields("seq"));
        builder.setBolt("join", new SingleJoinBolt(new Fields("friendsCount", "hashtags", "tweetinfolist")))
        	.fieldsGrouping("join1", new Fields("seq"))
        	.fieldsGrouping("tweets", new Fields("seq"));
        builder.setBolt("filter", new Q2FilterTweetBolt())
        	.shuffleGrouping("join");
//        builder.setBolt("printFiltered", new Q2PrintTweetBolt())
//    		.shuffleGrouping("filter");
//        builder.setBolt("cleanWord", new CleanWordsBolt())
//        	.shuffleGrouping("filter", "filterStream");
        builder.setBolt("splitWord", new SplitWordBolt())
        	.shuffleGrouping("filter");
        builder.setBolt("wordCount", new WordCountBolt(), 12)
        	.fieldsGrouping("splitWord", new Fields("word"));
        builder.setBolt("intermediateRanking", new IntermediateRankingsBolt())
        	.shuffleGrouping("wordCount");
        builder.setBolt("totalRanking",  new TotalRankingsBolt())
        	.globalGrouping("intermediateRanking");
        builder.setBolt("printFinal", new Q2PrintTweetBolt())
        	.shuffleGrouping("totalRanking");

                
        Config conf = new Config();
        conf.setDebug(true);
        
        final LocalCluster cluster = new LocalCluster();
        StormTopology topo = builder.createTopology();
        cluster.submitTopology("Q2", conf, topo);
        
        //Utils.sleep(interval * 100);
		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				cluster.killTopology("Q2");
				cluster.shutdown();
			}
		});
        //cluster.shutdown();
    }
 

开发者ID:luozhaoyu,
项目名称:big-data-system,
代码行数:69,
代码来源:Q2Stream.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)