com.cloudera.oryx.kafka.util.KafkaUtils.maybeCreateTopic()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中com.cloudera.oryx.kafka.util.KafkaUtils.maybeCreateTopic()方法的一些代码示例,展示了KafkaUtils.maybeCreateTopic()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KafkaUtils.maybeCreateTopic()方法的具体详情如下:
包路径:com.cloudera.oryx.kafka.util.KafkaUtils
类名称:KafkaUtils
方法名:maybeCreateTopic

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());
}

相关文章

微信公众号

最新文章

更多