當前位置: 首頁>>代碼示例>>Java>>正文


Java Config.setMaxSpoutPending方法代碼示例

本文整理匯總了Java中backtype.storm.Config.setMaxSpoutPending方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.setMaxSpoutPending方法的具體用法?Java Config.setMaxSpoutPending怎麽用?Java Config.setMaxSpoutPending使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在backtype.storm.Config的用法示例。


在下文中一共展示了Config.setMaxSpoutPending方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    conf.setMaxSpoutPending(5);
    if (args.length == 1) {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("wordCounter", conf, buildTopology(args[0]));
        Thread.sleep(60 * 1000);
        cluster.killTopology("wordCounter");
        cluster.shutdown();
        System.exit(0);
    }
    else if(args.length == 2) {
        conf.setNumWorkers(3);
        StormSubmitter.submitTopology(args[1], conf, buildTopology(args[0]));
    } else{
        System.out.println("Usage: TridentFileTopology <hdfs url> [topology name]");
    }
}
 
開發者ID:mengzhiyi,項目名稱:storm-hbase-1.0.x,代碼行數:19,代碼來源:WordCountTrident.java

示例2: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
	    MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA, new Fields("word"), PARTITION_TAKE_PER_BATCH);
	    TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder("global-count", "spout", spout, 2);
	    builder.setBolt("partial-count", new BatchCount(), 3).noneGrouping("spout");
	    builder.setBolt("sum", new UpdateGlobalCount(), 1).globalGrouping("partial-count");

//	    LocalCluster cluster = new LocalCluster();

	    Config config = new Config();
	    config.setDebug(true);
	    config.setMaxSpoutPending(3);
	    config.put(Config.TOPOLOGY_WORKERS, 9);
	    Config.setNumAckers(config, 0);
	    
	    StormSubmitter.submitTopology("global-count-topology", config, builder.buildTopology());

//	    Thread.sleep(3000);
//	    cluster.shutdown();
	  }
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:20,代碼來源:TransactionalGlobalCount.java

示例3: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA, new Fields("word"), PARTITION_TAKE_PER_BATCH);
  TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder("global-count", "spout", spout, 3);
  builder.setBolt("partial-count", new BatchCount(), 5).noneGrouping("spout");
  builder.setBolt("sum", new UpdateGlobalCount()).globalGrouping("partial-count");

  LocalCluster cluster = new LocalCluster();

  Config config = new Config();
  config.setDebug(true);
  config.setMaxSpoutPending(3);

  cluster.submitTopology("global-count-topology", config, builder.buildTopology());

  Thread.sleep(3000);
  cluster.shutdown();
}
 
開發者ID:luozhaoyu,項目名稱:big-data-system,代碼行數:18,代碼來源:TransactionalGlobalCount.java

示例4: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  Config conf = new Config();
  conf.setMaxSpoutPending(20);
  if (args.length == 0) {
    LocalDRPC drpc = new LocalDRPC();
    LocalCluster cluster = new LocalCluster();
    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));
  }
}
 
開發者ID:luozhaoyu,項目名稱:big-data-system,代碼行數:18,代碼來源:TridentWordCount.java

示例5: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA, new Fields("word"), PARTITION_TAKE_PER_BATCH);
  TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder("top-n-words", "spout", spout, 2);
  builder.setBolt("count", new KeyedCountUpdater(), 5).fieldsGrouping("spout", new Fields("word"));
  builder.setBolt("bucketize", new Bucketize()).noneGrouping("count");
  builder.setBolt("buckets", new BucketCountUpdater(), 5).fieldsGrouping("bucketize", new Fields("bucket"));


  LocalCluster cluster = new LocalCluster();

  Config config = new Config();
  config.setDebug(true);
  config.setMaxSpoutPending(3);

  cluster.submitTopology("top-n-topology", config, builder.buildTopology());

  Thread.sleep(3000);
  cluster.shutdown();
}
 
開發者ID:luozhaoyu,項目名稱:big-data-system,代碼行數:20,代碼來源:TransactionalWords.java

示例6: test_transaction_word

import backtype.storm.Config; //導入方法依賴的package包/類
@Test
public void test_transaction_word() {
    try {
        MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA, new Fields("word"), PARTITION_TAKE_PER_BATCH);
        TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder("top-n-words", "spout", spout, 2);
        builder.setBolt("count", new KeyedCountUpdater(), 5).fieldsGrouping("spout", new Fields("word"));
        builder.setBolt("bucketize", new Bucketize()).shuffleGrouping("count");
        builder.setBolt("buckets", new BucketCountUpdater(), 5).fieldsGrouping("bucketize", new Fields("bucket"));

        LocalCluster cluster = new LocalCluster();

        Config config = new Config();
        config.setDebug(true);
        config.setMaxSpoutPending(3);

        cluster.submitTopology("top-n-topology", config, builder.buildTopology());

        JStormUtils.sleepMs(60 * 1000);
        cluster.shutdown();
    } catch (Exception e) {
        Assert.fail("Failed to run simple transaction");
    }

}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:25,代碼來源:TransactionalWordsTest.java

示例7: buildAndSubmit

import backtype.storm.Config; //導入方法依賴的package包/類
private void buildAndSubmit() throws AlreadyAliveException, InvalidTopologyException, AuthorizationException {
		final int numWorkers = Integer.valueOf(topologyConfig.getProperty("num.workers"));
		Config config = new Config();
		config.setDebug(DEBUG);
		config.setNumWorkers(numWorkers);
		config.setMaxSpoutPending(1000000);
		// https://github.com/apache/storm/tree/v0.10.0/external/storm-kafka
		config.setMessageTimeoutSecs(600);	// This value(30 secs by default) must
							// be larger than retryDelayMaxMs
							// (60 secs by default) in
							/// KafkaSpout.

		TopologyBuilder builder = new TopologyBuilder();
		configureKafkaSpout(builder, config);
		configureESBolts(builder, config);

//		LocalCluster cluster = new LocalCluster();
		StormSubmitter.submitTopology("LogAnalyzerV1", config, builder.createTopology());
	}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:20,代碼來源:LogAnalyzer.java

示例8: configureKafkaBolt

import backtype.storm.Config; //導入方法依賴的package包/類
private void configureKafkaBolt(TopologyBuilder builder, Config config) {
	String topic = topologyConfig.getProperty("kafka.topic");
	Properties props = new Properties();
	props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, brokerUrl);
	props.put(ProducerConfig.CLIENT_ID_CONFIG, "storm-kafka-producer");
	props.put("metadata.broker.list", brokerUrl);
	props.put("serializer.class", "kafka.serializer.StringEncoder");
	props.put("request.required.acks", "1");
	config.setMaxSpoutPending(20);
	config.put(KafkaBolt.KAFKA_BROKER_PROPERTIES, props);
	KafkaBolt<String, String> kafkaBolt = new KafkaBolt<String, String>().withTopicSelector(new DefaultTopicSelector(topic))
									.withTupleToKafkaMapper(new FieldNameBasedTupleToKafkaMapper<String, String>("key", "log"));
	builder.setBolt("KafkaBolt", kafkaBolt, 3).shuffleGrouping(SPOUT_ID).setDebug(DEBUG);
}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:15,代碼來源:ApLogGenerator.java

示例9: main

import backtype.storm.Config; //導入方法依賴的package包/類
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();

}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:20,代碼來源:StormPlayground.java

示例10: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
	Config conf = new Config();
	conf.setMaxSpoutPending(20);
	if (args.length == 0) {
		LocalDRPC drpc = new LocalDRPC();
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology("wordCounter", conf, buildTopology(drpc));
		for (int i = 0; i < 100; i++) {
			// The query takes as input a whitespace separated list of words
			// and return the sum of the counts for those words.
			System.out.println("DRPC RESULT: " + drpc.execute("words", "cat$$dog$$the$$man"));
			Thread.sleep(1000);
		}
	} else {
		conf.setNumWorkers(3);
		StormSubmitter.submitTopologyWithProgressBar(args[0], conf, buildTopology(null));
	}
}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:19,代碼來源:TridentWordCount.java

示例11: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
  TopologyBuilder builder = new TopologyBuilder();

  LOGGER.info("Starting..");
  builder.setSpout("trade", new DeliveryCheckSpout(), 1);
  builder.setBolt("eligibility", new DeliveryCheckBolt(), 10).shuffleGrouping("trade");
  builder.setBolt("odd", new DeliveryCheckOddBolt(), 10).shuffleGrouping("eligibility",
      "oddstream");
  builder.setBolt("even", new DeliveryCheckEvenBolt(), 10).shuffleGrouping("eligibility",
      "evenstream");

  Config conf = new Config();
  conf.setDebug(false);
  conf.setMaxSpoutPending(5);

  if (args != null && args.length > 0) {
    conf.setNumWorkers(1);
    LOGGER.info("Submitting DeliveryTopology");
    StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
  } else {

    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("DeliveryTopology", conf, builder.createTopology());
    Utils.sleep(100000000);
    cluster.killTopology("DeliveryTopology");
    cluster.shutdown();
  }
}
 
開發者ID:techysoul,項目名稱:java,代碼行數:29,代碼來源:DeliveryTopology.java

示例12: test_transaction_word

import backtype.storm.Config; //導入方法依賴的package包/類
@Test
public void test_transaction_word(){
	try {
		MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA,
				new Fields("word"), PARTITION_TAKE_PER_BATCH);
		TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder(
				"top-n-words", "spout", spout, 2);
		builder.setBolt("count", new KeyedCountUpdater(), 5).fieldsGrouping(
				"spout", new Fields("word"));
		builder.setBolt("bucketize", new Bucketize()).shuffleGrouping("count");
		builder.setBolt("buckets", new BucketCountUpdater(), 5).fieldsGrouping(
				"bucketize", new Fields("bucket"));

		LocalCluster cluster = new LocalCluster();

		Config config = new Config();
		config.setDebug(true);
		config.setMaxSpoutPending(3);

		cluster.submitTopology("top-n-topology", config,
				builder.buildTopology());

		JStormUtils.sleepMs(60 * 1000);
		cluster.shutdown();
	}catch(Exception e) {
		Assert.fail("Failed to run simple transaction");
	}
	
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:30,代碼來源:TransactionalWordsTest.java

示例13: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA, new Fields("word"), PARTITION_TAKE_PER_BATCH);
  TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder("global-count", "spout", spout, 3);
  builder.setBolt("partial-count", new BatchCount(), 5).noneGrouping("spout");
  builder.setBolt("sum", new UpdateGlobalCount()).globalGrouping("partial-count");

  Config config = new Config();
  config.setDebug(true);
  config.setMaxSpoutPending(3);
  
  if (args.length == 0){
      LocalCluster cluster = new LocalCluster();    
  
      cluster.submitTopology("global-count-topology", config, builder.buildTopology());
  
      Thread.sleep(100000);
      cluster.shutdown();
  }else {
  	
      config.setNumWorkers(3);
  	try {
      	Map yamlConf = LoadConf.LoadYaml(args[0]);
      	if (yamlConf != null) {
      		config.putAll(yamlConf);
      	}
  	}catch (Exception e) {
  		System.out.println("Input " + args[0] + " isn't one yaml ");
  	}

      StormSubmitter.submitTopology("global", config, builder.buildTopology());
  }
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:33,代碼來源:TransactionalGlobalCount.java

示例14: main

import backtype.storm.Config; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    conf.setMaxSpoutPending(4);
    LocalDRPC drpc = new LocalDRPC();
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("wordCounter", conf, buildTopology1(drpc));
    cluster.submitTopology("fruitCounter", conf, buildTopology2(drpc));
    for (int i = 0; i < 100; i++) {
        System.out.println("DRPC RESULT 1: " + drpc.execute("words", "cat the dog jumped"));
        System.out.println("DRPC RESULT 2: " + drpc.execute("fruits", "2 orange"));
        Thread.sleep(1000);
    }
}
 
開發者ID:adform,項目名稱:trident-aerospike,代碼行數:14,代碼來源:StormTridentAerospikeTopology.java

示例15: getConsumerConfig

import backtype.storm.Config; //導入方法依賴的package包/類
/**
 * Return the consumer topology config.
 *
 * @return the topology config
 */
public Config getConsumerConfig() {
    Config conf = new Config();
    conf.setMaxSpoutPending(20);
    //  conf.setDebug(true);
    return conf;
}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:12,代碼來源:TridentKafkaWordCount.java


注:本文中的backtype.storm.Config.setMaxSpoutPending方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。