public static void main(String[] args) throws Exception { LocalCluster localCluster = null; try { localCluster = new LocalCluster(); } finally { if (localCluster != null) { localCluster.shutdown(); } } }
private static void submitTopology(TopologyBuilder builder) { try { if (local_mode(conf)) { LocalCluster cluster = new LocalCluster(); cluster.submitTopology(String.valueOf(conf.get("topology.name")), conf, builder.createTopology()); Thread.sleep(200000); cluster.shutdown(); } else { StormSubmitter.submitTopology(String.valueOf(conf.get("topology.name")), conf, builder.createTopology()); } } catch (Exception e) { e.printStackTrace(); } }
public static void SetLocalTopology() throws Exception { TopologyBuilder builder = new TopologyBuilder(); conf.put(TOPOLOGY_BOLT_PARALLELISM_HINT, 1); SetBuilder(builder, conf); LOG.debug("test"); LOG.info("Submit log"); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("SplitMerge", conf, builder.createTopology()); Thread.sleep(60000); cluster.killTopology("SplitMerge"); cluster.shutdown(); }
public void SetLocalTopology() throws Exception { Config conf = getConf(); StormTopology topology = buildTopology(); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("SplitMerge", conf, topology); Thread.sleep(60000); cluster.shutdown(); }
public static void runTopologyLocally(StormTopology topology, String topologyName, Config conf, int runtimeInSeconds, Callback callback) throws Exception { LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topologyName, conf, topology); if (runtimeInSeconds < 120) { JStormUtils.sleepMs(120 * 1000); } else { JStormUtils.sleepMs(runtimeInSeconds * 1000); } if (callback != null) { callback.execute(topologyName); } cluster.killTopology(topologyName); cluster.shutdown(); }
public static void testDrpc() { LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation"); builder.addBolt(new ExclaimBolt(), 3); Config conf = new Config(); LocalDRPC drpc = new LocalDRPC(); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc)); try { Thread.sleep(30000); } catch (InterruptedException e) { // TODO Auto-generated catch block } try { for (String word : new String[] { "hello", "goodbye" }) { System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word)); } } catch (Exception e) { e.printStackTrace(); Assert.fail("Failed to run DRPC Test"); } drpc.shutdown(); cluster.shutdown(); }
cluster.submitTopology("wordCounter", conf, buildTopology(mapState, windowConfig)); Utils.sleep(60 * 1000); cluster.shutdown();
cluster.shutdown(); drpc.shutdown();
public static void testDrpc() { TopologyBuilder builder = new TopologyBuilder(); LocalDRPC drpc = new LocalDRPC(); DRPCSpout spout = new DRPCSpout("exclamation", drpc); builder.setSpout("drpc", spout); builder.setBolt("exclaim", new ExclamationBolt(), 3).shuffleGrouping("drpc"); builder.setBolt("return", new ReturnResults(), 3).shuffleGrouping("exclaim"); LocalCluster cluster = new LocalCluster(); Config conf = new Config(); cluster.submitTopology("exclaim", conf, builder.createTopology()); JStormUtils.sleepMs(30 * 1000); try { System.out.println(drpc.execute("exclamation", "aaa")); System.out.println(drpc.execute("exclamation", "bbb")); } catch (Exception e) { Assert.fail("Failed to test drpc"); } drpc.shutdown(); cluster.shutdown(); }
public static void stopLocalCluster() { if (localCluster != null) { localCluster.shutdown(); } }
public static void main(String[] args) throws Exception { LocalCluster localCluster = null; try { localCluster = new LocalCluster(); } finally { if (localCluster != null) { localCluster.shutdown(); } } }
@Override public void run() { cluster.killTopology(TOPOLOGY_NAME); cluster.shutdown(); } });
@Override public void run() { LOGGER.info("Shutting down the cluster..."); localCluster.killTopology(Constants.TOPOLOGY_NAME); localCluster.shutdown(); } });
public static void submitLocal(String topologyName,Map conf, StormTopology stormTopology)throws Exception{ LOG.info("Submit Local"); LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topologyName, conf, stormTopology); Thread.sleep(60000); cluster.killTopology(topologyName); cluster.shutdown(); LOG.info("shut down local cluster"); }
public static void submitLocal(String topologyName,Map conf, StormTopology stormTopology)throws Exception{ LOG.info("Submit Local"); LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topologyName, conf, stormTopology); Thread.sleep(60000); cluster.killTopology(topologyName); cluster.shutdown(); } public static void main(String[] args) throws Exception {
@Override public void finish(StormToolOptions options) throws Exception { try { if (sleepTime < 0) { logger.debug("Waiting forever"); while (true) { Utils.sleep(DEFAULT_SLEEP_TIME); } } else { logger.debug("Waiting " + sleepTime + " milliseconds"); Utils.sleep(sleepTime); } } finally { logger.debug("Killing topology"); cluster.killTopology(options.topologyName()); logger.debug("Shutting down cluster"); cluster.shutdown(); options.topologyCleanup(); } }
protected static void stopTopology() { if (cluster != null) { cluster.killTopology(TEST_TOPOLOGY_NAME); cluster.shutdown(); cluster = null; } } }
public static void main(String[] args) throws Exception { Config conf = new Config(); // conf.put(Config.TOPOLOGY_DEBUG,true); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("advanced_primitives", conf, advancedPrimitives(new FakeTweetsBatchSpout(1000))); Thread.sleep(30000); cluster.shutdown(); }
public static void main(String[] args) throws InterruptedException { Config config = new Config(); config.setDebug(true); config.setNumWorkers(2); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("test", config, createTopology()); LATCH.await(); System.out.println("Processing complete"); cluster.killTopology("test"); cluster.shutdown(); }
public static void main(String[] args) { final Config conf = new Config(); conf.setDebug(false); conf.setNumWorkers(2); conf.setMaxSpoutPending(1); conf.setFallBackOnJavaSerialization(false); conf.setSkipMissingKryoRegistrations(false); final LocalCluster cluster = new LocalCluster(); final TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("randomSpout1", new RandomFieldSpout(2, 0, 0, 1)); // (nfields,seed,min,max) builder.setSpout("randomSpout2", new RandomFieldSpout(2, 10, 0, 1)); // (nfields,seed,min,max) JoinBolt.connectNewBolt(builder); final StormTopology topology = builder.createTopology(); cluster.submitTopology("playTopology", conf, topology); Utils.sleep(10000); cluster.killTopology("playTopology"); cluster.shutdown(); } }