use of org.apache.storm.starter.bolt.IntermediateRankingsBolt in project storm by apache.
the class SkewedRollingTopWords method run.
/**
* Submits (runs) the topology.
*
* Usage: "SkewedRollingTopWords [topology-name] [-local]"
*
* By default, the topology is run locally under the name
* "slidingWindowCounts".
*
* Examples:
*
* ```
*
* # Runs in local mode (LocalCluster), with topology name "slidingWindowCounts"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.SkewedRollingTopWords -local
*
* # Runs in local mode (LocalCluster), with topology name "foobar"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.SkewedRollingTopWords foobar -local
*
* # Runs in local mode (LocalCluster) for 30 seconds, with topology name "foobar"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.SkewedRollingTopWords foobar -local -ttl 30
*
* # Runs in remote/cluster mode, with topology name "production-topology"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.SkewedRollingTopWords production-topology ```
*
* @param args
* First positional argument (optional) is topology name, second
* positional argument (optional) defines whether to run the topology
* locally ("-local") or remotely, i.e. on a real cluster.
* @throws Exception
*/
protected int run(String[] args) {
String topologyName = "slidingWindowCounts";
if (args.length >= 1) {
topologyName = args[0];
}
TopologyBuilder builder = new TopologyBuilder();
String spoutId = "wordGenerator";
String counterId = "counter";
String aggId = "aggregator";
String intermediateRankerId = "intermediateRanker";
String totalRankerId = "finalRanker";
builder.setSpout(spoutId, new TestWordSpout(), 5);
builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).partialKeyGrouping(spoutId, new Fields("word"));
builder.setBolt(aggId, new RollingCountAggBolt(), 4).fieldsGrouping(counterId, new Fields("obj"));
builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(aggId, new Fields("obj"));
builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
LOG.info("Topology name: " + topologyName);
return submit(topologyName, conf, builder);
}
use of org.apache.storm.starter.bolt.IntermediateRankingsBolt in project jstorm by alibaba.
the class RollingTopWords method wireTopology.
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);
}
use of org.apache.storm.starter.bolt.IntermediateRankingsBolt in project storm by apache.
the class RollingTopWords method run.
/**
* Submits (runs) the topology.
*
* Usage: "RollingTopWords [topology-name] [-local]"
*
* By default, the topology is run locally under the name
* "slidingWindowCounts".
*
* Examples:
*
* ```
*
* # Runs in local mode (LocalCluster), with topology name "slidingWindowCounts"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.RollingTopWords -local
*
* # Runs in local mode (LocalCluster), with topology name "foobar"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.RollingTopWords foobar -local
*
* # Runs in local mode (LocalCluster) for 30 seconds, with topology name "foobar"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.RollingTopWords foobar -local -ttl 30
*
* # Runs in remote/cluster mode, with topology name "production-topology"
* $ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.RollingTopWords production-topology ```
*
* @param args
* First positional argument (optional) is topology name, second
* positional argument (optional) defines whether to run the topology
* locally ("-local") or remotely, i.e. on a real cluster.
* @throws Exception
*/
protected int run(String[] args) {
String topologyName = "slidingWindowCounts";
if (args.length >= 1) {
topologyName = args[0];
}
TopologyBuilder builder = new TopologyBuilder();
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);
LOG.info("Topology name: " + topologyName);
return submit(topologyName, conf, builder);
}
use of org.apache.storm.starter.bolt.IntermediateRankingsBolt in project jstorm by alibaba.
the class SkewedRollingTopWords method wireTopology.
private void wireTopology() throws InterruptedException {
String spoutId = "wordGenerator";
String counterId = "counter";
String aggId = "aggregator";
String intermediateRankerId = "intermediateRanker";
String totalRankerId = "finalRanker";
builder.setSpout(spoutId, new TestWordSpout(), 5);
builder.setBolt(counterId, new RollingCountBolt(9, 3), 4).partialKeyGrouping(spoutId, new Fields("word"));
builder.setBolt(aggId, new RollingCountAggBolt(), 4).fieldsGrouping(counterId, new Fields("obj"));
builder.setBolt(intermediateRankerId, new IntermediateRankingsBolt(TOP_N), 4).fieldsGrouping(aggId, new Fields("obj"));
builder.setBolt(totalRankerId, new TotalRankingsBolt(TOP_N)).globalGrouping(intermediateRankerId);
}
Aggregations