public class RollingTopWords extends Object
This topology does a continuous computation of the top N words that the topology has seen in terms of cardinality. The top N computation is done in a completely scalable way, and a similar approach could be used to compute things like trending topics or trending images on Twitter.
Constructor and Description |
---|
RollingTopWords(String topologyName) |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
Submits (runs) the topology.
|
void |
runLocally() |
void |
runRemotely() |
public RollingTopWords(String topologyName) throws InterruptedException
InterruptedException
public void runLocally() throws InterruptedException
InterruptedException
public static void main(String[] args) throws Exception
Submits (runs) the topology.
Usage: “RollingTopWords [topology-name] [local|remote]”
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
# Runs in local mode (LocalCluster), with topology name "foobar"
$ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.RollingTopWords foobar
# 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 remote/cluster mode, with topology name "production-topology"
$ storm jar storm-starter-jar-with-dependencies.jar org.apache.storm.starter.RollingTopWords production-topology remote
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 (“remote”).Exception
Copyright © 2022 The Apache Software Foundation. All Rights Reserved.