本文整理了Java中kafka.utils.ZkUtils.zkClient()
方法的一些代码示例,展示了ZkUtils.zkClient()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtils.zkClient()
方法的具体详情如下:
包路径:kafka.utils.ZkUtils
类名称: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)) {
内容来源于网络,如有侵权,请联系作者删除!