当前位置: 首页>>代码示例>>Java>>正文


Java InvalidTopologyException类代码示例

本文整理汇总了Java中org.apache.storm.generated.InvalidTopologyException的典型用法代码示例。如果您正苦于以下问题:Java InvalidTopologyException类的具体用法?Java InvalidTopologyException怎么用?Java InvalidTopologyException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidTopologyException类属于org.apache.storm.generated包,在下文中一共展示了InvalidTopologyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args) throws AlreadyAliveException,
		InvalidTopologyException {
	// create an instance of TopologyBuilder class
	TopologyBuilder builder = new TopologyBuilder();
	// set the spout class
	builder.setSpout("SampleSpout", new SampleSpout(), 2);
	// set the bolt class
	builder.setBolt("SampleBolt", new SampleBolt(), 4).shuffleGrouping(
			"SampleSpout");
	Config conf = new Config();
	conf.setNumWorkers(3);
	// This statement submit the topology on remote
	// args[0] = name of topology
	try {
		StormSubmitter.submitTopology(args[0], conf,
				builder.createTopology());
	} catch (AlreadyAliveException alreadyAliveException) {
		System.out.println(alreadyAliveException);
	} catch (InvalidTopologyException invalidTopologyException) {
		System.out.println(invalidTopologyException);
	} catch (AuthorizationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Apache-Storm,代码行数:26,代码来源:SampleStormClusterTopology.java

示例2: submitTopology

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
private LocalCluster submitTopology() throws AlreadyAliveException,
        InvalidTopologyException {
    Config stormConfig = new Config();
    stormConfig.setDebug(false);
    stormConfig.setFallBackOnJavaSerialization(true);
    stormConfig.setNumWorkers(1);

    // enable backpressure since the spouts can move at a much faster speed than the bolts
    stormConfig.put(Config.TOPOLOGY_BACKPRESSURE_ENABLE, true);
    stormConfig.put(Config.TOPOLOGY_EXECUTOR_RECEIVE_BUFFER_SIZE, 2048);
    stormConfig.put(Config.TOPOLOGY_EXECUTOR_SEND_BUFFER_SIZE, 2048);
    stormConfig.put(Config.TOPOLOGY_SLEEP_SPOUT_WAIT_STRATEGY_TIME_MS, 1000);
    stormConfig.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 10);

    stormConfig.setSkipMissingKryoRegistrations(true);
    stormConfig.put(ConfigurationConstants.CHATALYTICS_CONFIG.txt,
                    YamlUtils.writeYaml(chatalyticsConfig));

    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology(TOPOLOGY_NAME, stormConfig, chatTopology);
    return cluster;
}
 
开发者ID:OpenChatAlytics,项目名称:OpenChatAlytics,代码行数:23,代码来源:ChatAlyticsService.java

示例3: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(final String[] args) throws AlreadyAliveException, InvalidTopologyException,
NotAliveException {

	if (!WordCountTopology.parseParameters(args)) {
		return;
	}

	// build Topology the Storm way
	final TopologyBuilder builder = WordCountTopology.buildTopology();

	// execute program on Flink cluster
	final Config conf = new Config();
	// can be changed to remote address
	conf.put(Config.NIMBUS_HOST, "localhost");
	// use default flink jobmanger.rpc.port
	conf.put(Config.NIMBUS_THRIFT_PORT, 6123);

	final FlinkClient cluster = FlinkClient.getConfiguredClient(conf);
	cluster.submitTopology(topologyId, uploadedJarLocation, FlinkTopology.createTopology(builder));

	Utils.sleep(5 * 1000);

	cluster.killTopology(topologyId);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:WordCountRemoteByClient.java

示例4: run

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
private static void run(String name)
        throws ClassNotFoundException, IllegalAccessException,
        InstantiationException, AlreadyAliveException, InvalidTopologyException {
  LOG.info("running benchmark " + name);
  IBenchmark benchmark =  (IBenchmark) Runner.getApplicationFromName(PACKAGE + "." + name);
  Config config = new Config();
  config.putAll(Utils.readStormConfig());
  config.setDebug(true);
  StormTopology topology = benchmark.getTopology(config);
  LocalCluster localCluster = new LocalCluster();
  localCluster.submitTopology(name, config, topology);
  final int runtime = BenchmarkUtils.getInt(config, MetricsCollectorConfig.METRICS_TOTAL_TIME,
          MetricsCollectorConfig.DEFAULT_TOTAL_TIME);
  IMetricsCollector collector = benchmark.getMetricsCollector(config, topology);
  collector.run();
  try {
    Thread.sleep(runtime);
  } catch (InterruptedException e) {
    LOG.error("benchmark interrupted", e);
  }
  localCluster.shutdown();
}
 
开发者ID:MBtech,项目名称:stormbenchmark,代码行数:23,代码来源:LocalRunner.java

示例5: submitTopology

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
public void submitTopology(String topoName,
                           Map config,
                           StormTopology stormTopology)
    throws AlreadyAliveException, InvalidTopologyException {
  assertNotAlive();

  this.topologyName = topoName;
  this.conf = config;
  this.topology = stormTopology;

  simulator.submitTopology(topoName,
      ConfigUtils.translateConfig(config),
      stormTopology.getStormTopology());
}
 
开发者ID:twitter,项目名称:heron,代码行数:17,代码来源:LocalCluster.java

示例6: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
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();
}
 
开发者ID:chuidiang,项目名称:chuidiang-ejemplos,代码行数:17,代码来源:StormMain.java

示例7: run

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
protected void run() {
	Config config = new Config();
	config.setNumWorkers(2);
	config.setMessageTimeoutSecs(120);

	try {
		StormSubmitter.submitTopology(builder.getTopologyName(), config, builder.build());
	} catch (AlreadyAliveException | InvalidTopologyException | AuthorizationException e) {
		String message = "could not submit topology" + builder.getTopologyName();
		logger.error(message, e);
		throw new StormException(message, e);
	}	
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:14,代码来源:AbstractRemoteTopologyRunner.java

示例8: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args)
        throws InvalidTopologyException, AuthorizationException, AlreadyAliveException, InterruptedException {
    ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args);
    AppMain appMain = context.getBean(AppMain.class);
    appMain.Laugher();
    SpringApplication.exit(context);
}
 
开发者ID:Paleozoic,项目名称:storm_spring_boot_demo,代码行数:8,代码来源:DemoApplication.java

示例9: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args) throws AlreadyAliveException,
		InvalidTopologyException {
	TopologyBuilder builder = new TopologyBuilder();

	// set the spout class
	builder.setSpout("spout", new SampleSpout(), 2);
	// set the ES bolt class
	builder.setBolt("bolt", new EsperBolt(), 2)
			.shuffleGrouping("spout");
	Config conf = new Config();
	conf.setDebug(true);
	// create an instance of LocalCluster class for
	// executing topology in local mode.
	LocalCluster cluster = new LocalCluster();

	// EsperTopology is the name of submitted topology.
	cluster.submitTopology("EsperTopology", conf,
			builder.createTopology());
	try {
		Thread.sleep(60000);
	} catch (Exception exception) {
		System.out.println("Thread interrupted exception : " + exception);
	}
	System.out.println("Stopped Called : ");
	// kill the LearningStormTopology
	cluster.killTopology("EsperTopology");
	// shutdown the storm test cluster
	cluster.shutdown();

}
 
开发者ID:PacktPublishing,项目名称:Mastering-Apache-Storm,代码行数:31,代码来源:EsperTopology.java

示例10: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args) throws AlreadyAliveException,
		InvalidTopologyException {
	TopologyBuilder builder = new TopologyBuilder();

	List<String> zks = new ArrayList<String>();
	zks.add("127.0.0.1");

	List<String> cFs = new ArrayList<String>();
	cFs.add("personal");
	cFs.add("company");

	// set the spout class
	builder.setSpout("spout", new SampleSpout(), 2);
	// set the bolt class
	builder.setBolt("bolt", new StormHBaseBolt("user", cFs, zks, 2181), 2)
			.shuffleGrouping("spout");
	Config conf = new Config();
	conf.setDebug(true);
	// create an instance of LocalCluster class for
	// executing topology in local mode.
	LocalCluster cluster = new LocalCluster();

	// LearningStormTopolgy is the name of submitted topology.
	cluster.submitTopology("StormHBaseTopology", conf,
			builder.createTopology());
	try {
		Thread.sleep(60000);
	} catch (Exception exception) {
		System.out.println("Thread interrupted exception : " + exception);
	}
	System.out.println("Stopped Called : ");
	// kill the LearningStormTopology
	cluster.killTopology("StormHBaseTopology");
	// shutdown the storm test cluster
	cluster.shutdown();

}
 
开发者ID:PacktPublishing,项目名称:Mastering-Apache-Storm,代码行数:38,代码来源:Topology.java

示例11: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args) throws AlreadyAliveException,
		InvalidTopologyException {
	TopologyBuilder builder = new TopologyBuilder();

	//ES Node list
	List<String> esNodes = new ArrayList<String>();
	esNodes.add("10.191.209.14");

	// set the spout class
	builder.setSpout("spout", new SampleSpout(), 2);
	// set the ES bolt class
	builder.setBolt("bolt", new ESBolt(esNodes), 2)
			.shuffleGrouping("spout");
	Config conf = new Config();
	conf.setDebug(true);
	// create an instance of LocalCluster class for
	// executing topology in local mode.
	LocalCluster cluster = new LocalCluster();

	// ESTopology is the name of submitted topology.
	cluster.submitTopology("ESTopology", conf,
			builder.createTopology());
	try {
		Thread.sleep(60000);
	} catch (Exception exception) {
		System.out.println("Thread interrupted exception : " + exception);
	}
	System.out.println("Stopped Called : ");
	// kill the LearningStormTopology
	cluster.killTopology("StormHBaseTopology");
	// shutdown the storm test cluster
	cluster.shutdown();

}
 
开发者ID:PacktPublishing,项目名称:Mastering-Apache-Storm,代码行数:35,代码来源:ESTopology.java

示例12: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args) throws AlreadyAliveException,
		InvalidTopologyException {
	// create an instance of TopologyBuilder class
	TopologyBuilder builder = new TopologyBuilder();
	// set the spout class
	builder.setSpout("SampleSpout", new SampleSpout(), 2);
	// set the bolt class
	builder.setBolt("SampleBolt", new SampleBolt(), 4).shuffleGrouping(
			"SampleSpout");
	Config conf = new Config();
	conf.setDebug(true);
	// create an instance of LocalCluster class for
	// executing topology in local mode.
	LocalCluster cluster = new LocalCluster();
	// SampleStormTopology is the name of submitted topology
	cluster.submitTopology("SampleStormTopology", conf,
			builder.createTopology());
	try {
		Thread.sleep(100000);
	} catch (Exception exception) {
		System.out.println("Thread interrupted exception : " + exception);
	}
	// kill the SampleStormTopology
	cluster.killTopology("SampleStormTopology");
	// shutdown the storm test cluster
	cluster.shutdown();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Apache-Storm,代码行数:28,代码来源:SampleStormTopology.java

示例13: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args)
		throws InterruptedException, AlreadyAliveException, InvalidTopologyException, AuthorizationException {
	RandomSpout r = new RandomSpout();

	// Sliding window used to test withLag
	// BaseWindowedBolt b = new WindowDemoBolt().withTimestampField("time")
	// .withWindow(new Duration(5, TimeUnit.SECONDS), new Duration(3,
	// TimeUnit.SECONDS))
	// // When get tuple with timestamp
	// // t1(10:00:10),t2(10:00:14),t3(10:00:12),t4(10:00:16) in turn,
	// // If we won't set withLag, storm would throw t3 away. But if
	// // setted and (lag + t3) > t2, t3 will not be dropped.
	// .withLag(new Duration(2, TimeUnit.SECONDS));

	// Sliding window used to test watermark
	BaseWindowedBolt b = new WindowDemoBolt().withTimestampField("time")
			.withWindow(new Duration(20, TimeUnit.SECONDS), new Duration(10, TimeUnit.SECONDS))
			.withLag(new Duration(5, TimeUnit.SECONDS));

	TopologyBuilder builder = new TopologyBuilder();
	builder.setSpout("spout", r);
	builder.setBolt("window-bolt", b).shuffleGrouping("spout");

	Config conf = new Config();
	if (args.length == 0) {
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology("test", conf, builder.createTopology());
		Thread.sleep(3600000L);
		cluster.shutdown();
	} else {
		StormSubmitter.submitTopology("test-window", conf, builder.createTopology());
	}
}
 
开发者ID:zhai3516,项目名称:storm-demos,代码行数:34,代码来源:App.java

示例14: runPirkTopology

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void runPirkTopology() throws PIRException
{
  // Set up Kafka parameters
  logger.info("Configuring Kafka.");
  String zkRoot = "/" + kafkaTopic + "_pirk_storm";
  BrokerHosts zkHosts = new ZkHosts(brokerZk);
  SpoutConfig kafkaConfig = new SpoutConfig(zkHosts, kafkaTopic, zkRoot, kafkaClientId);
  kafkaConfig.ignoreZkOffsets = forceFromStart;

  // Create conf
  logger.info("Retrieving Query and generating Storm conf.");
  Config conf = createStormConf();
  Query query = StormUtils.getQuery(useHdfs, hdfsUri, queryFile);
  conf.put(StormConstants.N_SQUARED_KEY, query.getNSquared().toString());
  conf.put(StormConstants.QUERY_INFO_KEY, query.getQueryInfo().toMap());

  // Configure this for different types of input data on Kafka.
  kafkaConfig.scheme = new SchemeAsMultiScheme(new PirkHashScheme(conf));

  // Create topology
  StormTopology topology = getPirkTopology(kafkaConfig);

  // Run topology
  logger.info("Submitting Pirk topology to Storm...");
  try
  {
    StormSubmitter.submitTopologyWithProgressBar(topologyName, conf, topology);
  } catch (AlreadyAliveException | InvalidTopologyException | AuthorizationException e)
  {
    throw new PIRException(e);
  }

}
 
开发者ID:apache,项目名称:incubator-pirk,代码行数:34,代码来源:PirkTopology.java

示例15: main

import org.apache.storm.generated.InvalidTopologyException; //导入依赖的package包/类
public static void main(String[] args)
		throws InterruptedException, InvalidTopologyException, AuthorizationException, AlreadyAliveException {

	String topologyName = "TSAS";// 元组名
	// Zookeeper主机地址,会自动选取其中一个
	ZkHosts zkHosts = new ZkHosts("192.168.230.128:2181,192.168.230.129:2181,192.168.230.131:2181");
	String topic = "trademx";
	String zkRoot = "/storm";// storm在Zookeeper上的根路径
	String id = "tsaPro";

	// 创建SpoutConfig对象
	SpoutConfig spontConfig = new SpoutConfig(zkHosts, topic, zkRoot, id);

	TopologyBuilder builder = new TopologyBuilder();
	builder.setSpout("kafka", new KafkaSpout(spontConfig), 2);
	builder.setBolt("AccBolt", new AccBolt()).shuffleGrouping("kafka");
	builder.setBolt("ToDbBolt", new ToDbBolt()).shuffleGrouping("AccBolt");

	Config config = new Config();
	config.setDebug(false);

	if (args.length == 0) { // 本地运行,用于测试
		LocalCluster localCluster = new LocalCluster();
		localCluster.submitTopology(topologyName, config, builder.createTopology());
		Thread.sleep(1000 * 3600);
		localCluster.killTopology(topologyName);
		localCluster.shutdown();
	} else { // 提交至集群运行
		StormSubmitter.submitTopology(topologyName, config, builder.createTopology());
	}

}
 
开发者ID:monsonlee,项目名称:BigData,代码行数:33,代码来源:StormKafkaProcess.java


注:本文中的org.apache.storm.generated.InvalidTopologyException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。