本文整理了Java中com.cloudera.oryx.kafka.util.KafkaUtils.maybeCreateTopic()
方法的一些代码示例,展示了KafkaUtils.maybeCreateTopic()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KafkaUtils.maybeCreateTopic()
方法的具体详情如下:
包路径:com.cloudera.oryx.kafka.util.KafkaUtils
类名称:KafkaUtils
方法名:maybeCreateTopic
暂无
代码示例来源:origin: OryxProject/oryx
/**
* @param zkServers Zookeeper server string: host1:port1[,host2:port2,...]
* @param topic topic to create (if not already existing)
* @param partitions number of topic partitions
*/
public static void maybeCreateTopic(String zkServers, String topic, int partitions) {
maybeCreateTopic(zkServers, topic, partitions, new Properties());
}
代码示例来源:origin: OryxProject/oryx
protected final void startMessaging() throws IOException, InterruptedException {
log.info("Starting local test Zookeeper server");
localZKServer = new LocalZKServer(localZKPort);
localZKServer.start();
log.info("Starting local Kafka broker");
localKafkaBroker = new LocalKafkaBroker(localKafkaBrokerPort, localZKPort);
localKafkaBroker.start();
String zkHostPort = "localhost:" + localZKPort;
KafkaUtils.deleteTopic(zkHostPort, INPUT_TOPIC);
KafkaUtils.deleteTopic(zkHostPort, UPDATE_TOPIC);
KafkaUtils.maybeCreateTopic(zkHostPort, INPUT_TOPIC, 1);
KafkaUtils.maybeCreateTopic(zkHostPort, UPDATE_TOPIC, 1);
// Give topics a little time to elect leader
try {
Thread.sleep(5000);
} catch (InterruptedException ie) {
// continue
}
}
代码示例来源:origin: OryxProject/oryx
KafkaUtils.maybeCreateTopic(zkHostPort, TOPIC, 4);
代码示例来源:origin: OryxProject/oryx
KafkaUtils.maybeCreateTopic(zkHostPort, TOPIC, 1, ConfigUtils.keyValueToProperties(
"max.message.bytes", maxMessageSize
));
代码示例来源:origin: com.cloudera.oryx/kafka-util
/**
* @param zkServers Zookeeper server string: host1:port1[,host2:port2,...]
* @param topic topic to create (if not already existing)
* @param partitions number of topic partitions
*/
public static void maybeCreateTopic(String zkServers, String topic, int partitions) {
maybeCreateTopic(zkServers, topic, partitions, new Properties());
}
内容来源于网络,如有侵权,请联系作者删除!