本文整理了Java中kafka.utils.ZKConfig.ZkConnectProp()
方法的一些代码示例,展示了ZKConfig.ZkConnectProp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKConfig.ZkConnectProp()
方法的具体详情如下:
包路径:kafka.utils.ZKConfig
类名称:ZKConfig
方法名:ZkConnectProp
暂无
代码示例来源:origin: confluentinc/ksql
/**
* Creates and starts a Kafka cluster.
*/
public void start() throws Exception {
log.debug("Initiating embedded Kafka cluster startup");
installJaasConfig();
zookeeper = new ZooKeeperEmbedded();
brokerConfig.put(SimpleAclAuthorizer.ZkUrlProp(), zookeeper.connectString());
// Streams runs multiple consumers, so let's give them all a chance to join.
// (Tests run quicker and with a more stable consumer group):
brokerConfig.put("group.initial.rebalance.delay.ms", 100);
broker = new KafkaEmbedded(effectiveBrokerConfigFrom());
clientConfig.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers());
authorizer.configure(ImmutableMap.of(ZKConfig.ZkConnectProp(), zookeeperConnect()));
}
代码示例来源:origin: com.cerner.common.kafka/common-kafka-test
/**
* Returns properties for either a Kafka producer or consumer.
*
* @return Combined producer and consumer properties.
*/
public Properties getProps() {
// Combine producer and consumer properties.
Properties props = getProducerProps();
props.putAll(getConsumerProps());
// Add zookeeper connect which can be used by KafkaAdminClient or other older clients
props.setProperty(ZKConfig.ZkConnectProp(), brokerConfigs.get(0).zkConnect());
return props;
}
代码示例来源:origin: com.cerner.common.kafka/common-kafka-admin
/**
* Returns an {@link Authorizer} to make {@link Acl} requests
*
* @return an {@link Authorizer} to make {@link Acl} requests
*
* @throws AdminOperationException
* if there is an issue creating the authorizer
*/
public Authorizer getAuthorizer() {
if (authorizer == null) {
ZKConfig zkConfig = new ZKConfig(new VerifiableProperties(properties));
Map<String, Object> authorizerProps = new HashMap<>();
authorizerProps.put(ZKConfig.ZkConnectProp(), zkConfig.zkConnect());
authorizerProps.put(ZKConfig.ZkConnectionTimeoutMsProp(), zkConfig.zkConnectionTimeoutMs());
authorizerProps.put(ZKConfig.ZkSessionTimeoutMsProp(), zkConfig.zkSessionTimeoutMs());
authorizerProps.put(ZKConfig.ZkSyncTimeMsProp(), zkConfig.zkSyncTimeMs());
try {
Authorizer simpleAclAuthorizer = new SimpleAclAuthorizer();
simpleAclAuthorizer.configure(authorizerProps);
authorizer = simpleAclAuthorizer;
} catch (ZkException e) {
throw new AdminOperationException("Unable to create authorizer", e);
}
}
return authorizer;
}
内容来源于网络,如有侵权,请联系作者删除!