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(); }
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 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();
LocalDRPC drpc = new LocalDRPC(); LocalCluster cluster = new LocalCluster(); cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createLocalTopology(drpc));
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(); }
@Override public void submitTopology(StormToolOptions options) throws Exception { logger.debug("Configuring topology"); Config conf = options.prepareConfig(); logger.debug("Instantiating cluster"); this.cluster = new LocalCluster(); logger.debug("Constructing topology"); StormTopology topology = options.constructTopology(); logger.debug("Submitting topology"); cluster.submitTopology(options.topologyName(), conf, topology); }
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 submitTopology(StormToolOptions options) throws Exception { logger.debug("Configuring topology"); Config conf = options.prepareConfig(); logger.debug("Instantiating cluster"); this.cluster = new LocalCluster(); logger.debug("Constructing topology"); StormTopology topology = options.constructTopology(); logger.debug("Submitting topology"); cluster.submitTopology(options.topologyName(), conf, topology); }
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 Exception { Config conf = new Config(); LocalDRPC drpc = new LocalDRPC(); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("hackaton", conf, buildTopology(drpc)); } }
public static void main(String[] args) throws Exception { Config conf = new Config(); LocalDRPC drpc = new LocalDRPC(); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("hackaton", conf, buildTopology(drpc)); } }
public static LocalCluster runPageviews() { LocalCluster cluster = new LocalCluster(); Config conf = new Config(); cluster.submitTopology("pageviews", conf, pageviewsOverTime().build()); return cluster; }
public static LocalCluster runBounces() { LocalCluster cluster = new LocalCluster(); Config conf = new Config(); cluster.submitTopology("bounces", conf, bounceRateOverTime().build()); return cluster; } }
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) throws Exception { Config conf = new Config(); // conf.put(Config.TOPOLOGY_DEBUG,true); LocalCluster cluster = new LocalCluster(); // This time we use a "FeederBatchSpout", a spout designed for testing. FeederBatchSpout testSpout = new FeederBatchSpout(ImmutableList.of("name", "city", "age")); cluster.submitTopology("advanced_primitives", conf, advancedPrimitives(testSpout)); // You can "hand feed" values to the topology by using this spout testSpout.feed(ImmutableList.of(new Values("rose", "Shanghai", 32), new Values("mary", "Shanghai", 51), new Values("pere", "Jakarta", 65), new Values("Tom", "Jakarta", 10))); }
public static void main(String[] args) throws Exception { final TopologyBuilder builder = new TopologyBuilder(); final KestrelThriftSpout spout = new KestrelThriftSpout("localhost", 2229, "test", new StringScheme()); builder.setSpout("spout", spout).setDebug(true); builder.setBolt("bolt", new FailEveryOther()) .shuffleGrouping("spout"); final LocalCluster cluster = new LocalCluster(); final Config conf = new Config(); cluster.submitTopology("test", conf, builder.createTopology()); Thread.sleep(600000); } }
public static void main(String[] args) throws Exception { final TopologyBuilder builder = new TopologyBuilder(); final KestrelThriftSpout spout = new KestrelThriftSpout("localhost", 2229, "test", new StringScheme()); builder.setSpout("spout", spout).setDebug(true); builder.setBolt("bolt", new FailEveryOther()) .shuffleGrouping("spout"); final LocalCluster cluster = new LocalCluster(); final Config conf = new Config(); cluster.submitTopology("test", conf, builder.createTopology()); Thread.sleep(600000); } }