public void setNumWorkers(int workers) { setNumWorkers(this, workers); }
public static void main(String[] args) throws Exception { if (args.length != 2) { System.out.println("Usage: WordCountTrident redis-host redis-port"); System.exit(1); } String redisHost = args[0]; Integer redisPort = Integer.valueOf(args[1]); Config conf = new Config(); conf.setMaxSpoutPending(5); conf.setNumWorkers(3); StormSubmitter.submitTopology("test_wordCounter_for_redis", conf, buildTopology(redisHost, redisPort)); }
public static void main(String[] args) throws Exception { if (args.length != 2) { System.out.println("Usage: WordCountTrident redis-host redis-port"); System.exit(1); } String redisHost = args[0]; Integer redisPort = Integer.valueOf(args[1]); Config conf = new Config(); conf.setMaxSpoutPending(5); conf.setNumWorkers(3); StormSubmitter.submitTopology("test_wordCounter_for_redis", conf, buildTopology(redisHost, redisPort)); } }
public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: WordCountTrident 127.0.0.1:6379,127.0.0.1:6380"); System.exit(1); } String redisHostPort = args[0]; Config conf = new Config(); conf.setMaxSpoutPending(5); conf.setNumWorkers(3); StormSubmitter.submitTopology("test_wordCounter_for_redis", conf, buildTopology(redisHostPort)); }
public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: WordCountTrident 127.0.0.1:6379,127.0.0.1:6380"); System.exit(1); } String redisHostPort = args[0]; Config conf = new Config(); conf.setMaxSpoutPending(5); conf.setNumWorkers(3); StormSubmitter.submitTopology("test_wordCounter_for_redis", conf, buildTopology(redisHostPort)); }
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")); String topoName = "wordCounterWithWindowing"; if (args.length > 0) { topoName = args[0]; } conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar(topoName, conf, buildTopology(windowStoreFactory)); }
public static void main(String[] args) throws Exception { Config conf = new Config(); conf.setMaxSpoutPending(5); String topoName = "wordCounter"; if (args.length == 3) { topoName = args[2]; } else if (args.length > 3 || args.length < 2) { System.out.println("Usage: WordCountTrident <mongodb url> <mongodb collection> [topology name]"); return; } conf.setNumWorkers(3); StormSubmitter.submitTopology(topoName, conf, buildTopology(args[0], args[1])); }
public static void main(String[] args) throws Exception { Config conf = new Config(); conf.setMaxSpoutPending(5); String topoName = "wordCounter"; if (args.length == 2) { topoName = args[1]; } else if (args.length > 2) { System.out.println("Usage: WordCountTrident <hbase.rootdir> [topology name]"); return; } conf.setNumWorkers(3); StormSubmitter.submitTopology(topoName, conf, buildTopology(args[0])); }
public static void main(String[] args) throws Exception { Config conf = new Config(); conf.setMaxSpoutPending(5); String topoName = "wordCounter"; if (args.length == 3) { topoName = args[2]; } else if (args.length > 3 || args.length < 2) { System.out.println("Usage: WordCountTrident <mongodb url> <mongodb collection> [topology name]"); return; } conf.setNumWorkers(3); StormSubmitter.submitTopology(topoName, conf, buildTopology(args[0], args[1])); }
public static void main(String[] args) throws Exception { StormTopology topology = getStormTopology(); Config conf = new Config(); conf.setDebug(true); String topoName = "test"; if (args.length > 0) { topoName = args[0]; } conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar(topoName, conf, topology); }
public static void main(String[] args) throws Exception { StormTopology topology = buildDevicesTopology(); Config conf = new Config(); conf.setMaxSpoutPending(20); conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar("devices-topology", conf, topology); }
public static void main(String[] args) throws Exception { StormTopology topology = buildVehiclesTopology(); Config conf = new Config(); conf.setMaxSpoutPending(20); conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar("vehicles-topology", conf, topology); }
public static void main(String[] args) throws Exception { Config conf = new Config(); WindowsStoreFactory mapState = new InMemoryWindowsStoreFactory(); String topoName = "wordCounter"; if (args.length > 0) { topoName = args[0]; } conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar(topoName, conf, buildTopology(mapState, SlidingCountWindow.of(1000, 100))); } }
public static void main(String[] args) throws Exception { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("word", new TestWordSpout(), 10); builder.setBolt("exclaim1", new ExclamationLoggingBolt(), 3).shuffleGrouping("word"); builder.setBolt("exclaim2", new ExclamationLoggingBolt(), 2).shuffleGrouping("exclaim1"); Config conf = new Config(); conf.setDebug(true); String topoName = MultipleLoggerTopology.class.getName(); if (args != null && args.length > 0) { topoName = args[0]; } conf.setNumWorkers(2); StormSubmitter.submitTopologyWithProgressBar(topoName, conf, builder.createTopology()); }
public void buildAndLaunchWordCountTopology(String[] args) { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomSentenceSpout(), 5); builder.setBolt("split", new SplitSentence(), 8).shuffleGrouping("spout"); builder.setBolt("filter", new FilterWords(), 6).shuffleGrouping("split"); Config conf = new Config(); conf.setDebug(true); try { conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology()); } catch (InvalidTopologyException | AuthorizationException | AlreadyAliveException exp) { throw new RuntimeException(exp); } }
protected int run(String[] args) { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("word", new TestWordSpout(), 10); builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word"); builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1"); conf.setDebug(true); String topologyName = "test"; conf.setNumWorkers(3); if (args != null && args.length > 0) { topologyName = args[0]; } return submit(topologyName, conf, builder); }
protected int run(String[] args) throws Exception { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomSentenceSpout(), 5); builder.setBolt("split", new SplitSentence(), 8).shuffleGrouping("spout"); builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word")); conf.setDebug(true); String topologyName = "word-count"; conf.setNumWorkers(3); if (args != null && args.length > 0) { topologyName = args[0]; } return submit(topologyName, conf, builder); }
protected int run(String[] args) throws Exception { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomSentenceSpout(), 4); builder.setBolt("split", new SplitSentence(), 4).shuffleGrouping("spout"); builder.setBolt("count", new WordCount(), 4).fieldsGrouping("split", new Fields("word")); Config conf = new Config(); conf.setMaxTaskParallelism(3); String topologyName = "word-count"; conf.setNumWorkers(3); if (args != null && args.length > 0) { topologyName = args[0]; } return submit(topologyName, conf, builder); }
public static void main(String[] args) throws Exception { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomSentence(), 5); builder.setBolt("split", new SplitSentence(), 8).shuffleGrouping("spout"); builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word")); Config conf = new Config(); conf.setDebug(true); String topoName = "word-count"; if (args != null && args.length > 0) { topoName = args[0]; } conf.setNumWorkers(3); StormSubmitter.submitTopologyWithProgressBar(topoName, conf, builder.createTopology()); }
public static void main(String[] args) throws Exception { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomIntegerSpout()); builder.setBolt("partialsum", new StatefulSumBolt("partial"), 1).shuffleGrouping("spout"); builder.setBolt("printer", new PrinterBolt(), 2).shuffleGrouping("partialsum"); builder.setBolt("total", new StatefulSumBolt("total"), 1).shuffleGrouping("printer"); Config conf = new Config(); conf.setDebug(false); String topoName = "test"; if (args != null && args.length > 0) { topoName = args[0]; } conf.setNumWorkers(1); StormSubmitter.submitTopologyWithProgressBar(topoName, conf, builder.createTopology()); }