Skip to content

Instantly share code, notes, and snippets.

@forcemax
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forcemax/2a39b3f11bd424840b34 to your computer and use it in GitHub Desktop.
Save forcemax/2a39b3f11bd424840b34 to your computer and use it in GitHub Desktop.
private static TopologyBuilder wireTopology() {
TopologyBuilder builder = new TopologyBuilder();
// Twitter API Key
String consumerKey = "consumerKey";
String consumerSecret = "consumerSecret";
String accessToken = "accessToken";
String accessTokenSecret = "accessTokenSecret";
String[] keyWords = new String[0];
builder.setSpout("twitter", new TwitterSpout(consumerKey, consumerSecret, accessToken, accessTokenSecret, keyWords));
builder.setBolt("extractHashTag", new ExtractHashTagBolt(), 6).shuffleGrouping("twitter");
builder.setBolt("rollingCount", new RollingCountBolt(60, 5), 12).fieldsGrouping("extractHashTag", new Fields("word"));
builder.setBolt("intermediateRanking", new IntermediateRankingsBolt(TOP_N, 5), 6).fieldsGrouping("rollingCount", new Fields("obj"));
builder.setBolt("totalRanker", new TotalRankingsBolt(TOP_N, 10)).globalGrouping("intermediateRanking");
builder.setBolt("print", new PrinterBolt(), 2).shuffleGrouping("totalRanker");
return builder;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment