gpt4 book ai didi

kafka.utils.ZkUtils.zkClient()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 00:56:40 28 4
gpt4 key购买 nike

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

ZkUtils.zkClient介绍

暂无

代码示例

代码示例来源:origin: com.cerner.common.kafka/common-kafka-test

/**
 * Returns a client for communicating with the Zookeeper service.
 *
 * @return A Zookeeper client.
 *
 * @throws IllegalStateException
 *             if Zookeeper has not yet been {@link #setUp()}, or has already been {@link #tearDown() torn down}.
 */
public ZkClient getZkClient() {
  if (zkUtils == null) {
    throw new IllegalStateException("Zookeeper service is not active");
  }
  return zkUtils.zkClient();
}

代码示例来源:origin: gnuhpc/Kafka-zk-restapi

.zkClient()
.writeData(
  "/consumers/" + consumerGroup + "/offsets/" + topic + "/" + partition, offset);

代码示例来源:origin: com.hurence.logisland/logisland-agent

public ZookeeperMasterElector(ZkUtils zkUtils,
               RegistryIdentity myIdentity,
               KafkaRegistry schemaRegistry,
               boolean isEligibleForMasterElection)
  throws RegistryTimeoutException, RegistryStoreException {
 this.zkClient = zkUtils.zkClient();
 this.zkUtils = zkUtils;
 this.myIdentity = myIdentity;
 try {
  this.myIdentityString = myIdentity.toJson();
 } catch (IOException e) {
  throw new RegistryStoreException(String.format(
    "Error while serializing schema registry identity %s to json", myIdentity.toString()), e);
 }
 this.schemaRegistry = schemaRegistry;
 zkClient.subscribeStateChanges(new SessionExpirationListener(isEligibleForMasterElection));
 zkClient.subscribeDataChanges(MASTER_PATH, 
                new MasterChangeListener(isEligibleForMasterElection));
 if (isEligibleForMasterElection) {
  electMaster();  
 } else {
  readCurrentMaster();
 }    
}

代码示例来源:origin: com.hurence.logisland/logisland-agent

if (!zkUtils.zkClient().exists(ZOOKEEPER_SCHEMA_ID_COUNTER)) {

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com