本文整理汇总了Java中backtype.storm.spout.MultiScheme类的典型用法代码示例。如果您正苦于以下问题:Java MultiScheme类的具体用法?Java MultiScheme怎么用?Java MultiScheme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiScheme类属于backtype.storm.spout包,在下文中一共展示了MultiScheme类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSpoutConfig
import backtype.storm.spout.MultiScheme; //导入依赖的package包/类
public static SpoutConfig getSpoutConfig(Map options, MultiScheme scheme) throws IllegalArgumentException {
String zkServers = (String) Utils.get(options, ZOOKEEPER_SERVERS, "localhost:2181");
String kafkaRoot = (String) Utils.get(options, KAFKA_ROOT_PATH, "/kafka");
String connectString = zkServers + kafkaRoot;
BrokerHosts hosts = new ZkHosts(connectString);
String topic = (String) Utils.get(options, TOPIC, DEFAULT_TOPIC);
String zkRoot = kafkaRoot + "/" + "storm-consumer-states";
String appId = (String) Utils.get(options, CLIENT_ID, "storm-app");
SpoutConfig config = new SpoutConfig(hosts, topic, zkRoot, appId);
config.zkServers = new ArrayList<String>();
String [] servers = zkServers.split(",");
for (int i = 0; i < servers.length; i++) {
String[] serverAndPort = servers[0].split(":");
config.zkServers.add(serverAndPort[0]);
int port = Integer.parseInt(serverAndPort[1]);
if (i == 0) {
config.zkPort = port;
}
if (config.zkPort != port) {
throw new IllegalArgumentException("The zookeeper port on all server must be same");
}
}
config.scheme = scheme;
return config;
}
开发者ID:manuzhang,项目名称:storm-benchmark,代码行数:31,代码来源:KafkaUtils.java
示例2: getTridentKafkaConfig
import backtype.storm.spout.MultiScheme; //导入依赖的package包/类
public static TridentKafkaConfig getTridentKafkaConfig(Map options, MultiScheme scheme) {
String zkServers = (String) Utils.get(options, ZOOKEEPER_SERVERS, "localhost:2181") ;
String kafkaRoot = (String) Utils.get(options, KAFKA_ROOT_PATH, "/kafka");
String connectString = zkServers + kafkaRoot;
BrokerHosts hosts = new ZkHosts(connectString);
String topic = (String) Utils.get(options, TOPIC, DEFAULT_TOPIC);
String appId = (String) Utils.get(options, CLIENT_ID, "storm-app");
TridentKafkaConfig config = new TridentKafkaConfig(hosts, topic, appId);
config.scheme = scheme;
return config;
}
开发者ID:manuzhang,项目名称:storm-benchmark,代码行数:14,代码来源:KafkaUtils.java
注:本文中的backtype.storm.spout.MultiScheme类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论