use of org.apache.storm.LocalCluster in project storm by apache.
the class TridentMapExample method main.
public static void main(String[] args) throws Exception {
Config conf = new Config();
conf.setMaxSpoutPending(20);
if (args.length == 0) {
try (LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
LocalTopology topo = cluster.submitTopology("wordCounter", conf, buildTopology(drpc))) {
for (int i = 0; i < 100; i++) {
System.out.println("DRPC RESULT: " + drpc.execute("words", "CAT THE DOG JUMPED"));
Thread.sleep(1000);
}
}
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, buildTopology(null));
}
}
use of org.apache.storm.LocalCluster in project storm by apache.
the class TridentMinMaxOfDevicesTopology method main.
public static void main(String[] args) throws Exception {
StormTopology topology = buildDevicesTopology();
Config conf = new Config();
conf.setMaxSpoutPending(20);
if (args.length == 0) {
try (LocalCluster cluster = new LocalCluster();
LocalTopology topo = cluster.submitTopology("devices-topology", conf, topology)) {
Utils.sleep(60 * 1000);
}
System.exit(0);
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar("devices-topology", conf, topology);
}
}
use of org.apache.storm.LocalCluster in project storm by apache.
the class KafkaSpoutTopologyMainNamedTopics method submitTopologyLocalCluster.
protected void submitTopologyLocalCluster(StormTopology topology, Config config) throws Exception {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", config, topology);
stopWaitingForInput();
}
use of org.apache.storm.LocalCluster in project chuidiang-ejemplos by chuidiang.
the class StormMain method main.
public static void main(String[] args) throws InterruptedException, AlreadyAliveException, InvalidTopologyException, AuthorizationException {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(DATA_GENERATOR, new ASpout());
builder.setBolt(DATA_CALCULATOR, new ABolt()).shuffleGrouping(DATA_GENERATOR);
builder.setBolt(DATA_PRINTER, new DataPrinter()).shuffleGrouping(DATA_CALCULATOR).shuffleGrouping(DATA_GENERATOR);
Config config = new Config();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(TOPOLOGY_NAME, config, builder.createTopology());
Thread.sleep(100000);
cluster.killTopology(TOPOLOGY_NAME);
cluster.shutdown();
}
use of org.apache.storm.LocalCluster in project storm by apache.
the class TridentHBaseWindowingStoreTopology method main.
public static void main(String[] args) throws Exception {
Config conf = new Config();
conf.setMaxSpoutPending(20);
conf.put(Config.TOPOLOGY_TRIDENT_WINDOWING_INMEMORY_CACHE_LIMIT, 100);
// window-state table should already be created with cf:tuples column
HBaseWindowsStoreFactory windowStoreFactory = new HBaseWindowsStoreFactory(new HashMap<String, Object>(), "window-state", "cf".getBytes("UTF-8"), "tuples".getBytes("UTF-8"));
if (args.length == 0) {
try (LocalCluster cluster = new LocalCluster();
LocalTopology topo = cluster.submitTopology("wordCounterWithWindowing", conf, buildTopology(windowStoreFactory))) {
Utils.sleep(120 * 1000);
}
System.exit(0);
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, buildTopology(windowStoreFactory));
}
}
Aggregations