gpt4 book ai didi

kafka.zookeeper.ZooKeeperClient类的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 14:16:31 27 4
gpt4 key购买 nike

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

ZooKeeperClient介绍

暂无

代码示例

代码示例来源:origin: allegro/hermes

private BrokerOperations(Map<String, String> kafkaZkConnection, int sessionTimeout, int connectionTimeout,
             int maxInflightRequests, String namespace) {
  zkClients = kafkaZkConnection.entrySet().stream()
      .collect(toMap(Map.Entry::getKey,
              e -> {
                ZooKeeperClient zooKeeperClient = new ZooKeeperClient(
                    e.getValue(), connectionTimeout, sessionTimeout, maxInflightRequests,
                    Time.SYSTEM, ZOOKEEPER_METRIC_GROUP, ZOOKEEPER_METRIC_TYPE);
                return new KafkaZkClient(zooKeeperClient, false, Time.SYSTEM);
              }));
  kafkaNamesMapper = new JsonToAvroMigrationKafkaNamesMapper(namespace);
}

代码示例来源:origin: allegro/hermes

private ZooKeeperClient zooKeeperClient(KafkaProperties kafkaProperties) {
  ZooKeeperClient zooKeeperClient =  new ZooKeeperClient(
      kafkaProperties.getConnectionString(),
      kafkaProperties.getSessionTimeoutMillis(),
      kafkaProperties.getConnectionTimeoutMillis(),
      kafkaProperties.getMaxInflight(),
      Time.SYSTEM, ZOOKEEPER_METRIC_GROUP, ZOOKEEPER_METRIC_TYPE);
  zkClients.add(zooKeeperClient);
  zooKeeperClient.waitUntilConnected();
  return zooKeeperClient;
}

代码示例来源:origin: allegro/hermes

@BeforeClass
public static void beforeZookeeperClass() throws Exception {
  zookeeperServer = new TestingServer(45678);
  zookeeperClient = CuratorFrameworkFactory.builder()
      .connectString(zookeeperServer.getConnectString())
      .retryPolicy(new ExponentialBackoffRetry(1000, 3))
      .build();
  zookeeperClient.start();
  wait = new ZookeeperWaiter(zookeeperClient);
  wait.untilZookeeperClientStarted();
  ZooKeeperClient zooKeeperClient = new ZooKeeperClient(
      zookeeperServer.getConnectString(), 60 * 1000, 15 * 1000,
      10, Time.SYSTEM, "zookeeper-test", "zookeeper-test");
  zooKeeperClient.waitUntilConnected();
  kafkaZkClient = new KafkaZkClient(zooKeeperClient, false, Time.SYSTEM);
}

代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper

@BeforeClass
public static void beforeZookeeperClass() throws Exception {
  zookeeperServer = new TestingServer(45678);
  zookeeperClient = CuratorFrameworkFactory.builder()
      .connectString(zookeeperServer.getConnectString())
      .retryPolicy(new ExponentialBackoffRetry(1000, 3))
      .build();
  zookeeperClient.start();
  wait = new ZookeeperWaiter(zookeeperClient);
  wait.untilZookeeperClientStarted();
  ZooKeeperClient zooKeeperClient = new ZooKeeperClient(
      zookeeperServer.getConnectString(), 60 * 1000, 15 * 1000,
      10, Time.SYSTEM, "zookeeper-test", "zookeeper-test");
  zooKeeperClient.waitUntilConnected();
  kafkaZkClient = new KafkaZkClient(zooKeeperClient, false, Time.SYSTEM);
}

代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper

private BrokerOperations(Map<String, String> kafkaZkConnection, int sessionTimeout, int connectionTimeout,
             int maxInflightRequests, String namespace) {
  zkClients = kafkaZkConnection.entrySet().stream()
      .collect(toMap(Map.Entry::getKey,
              e -> {
                ZooKeeperClient zooKeeperClient = new ZooKeeperClient(
                    e.getValue(), connectionTimeout, sessionTimeout, maxInflightRequests,
                    Time.SYSTEM, ZOOKEEPER_METRIC_GROUP, ZOOKEEPER_METRIC_TYPE);
                return new KafkaZkClient(zooKeeperClient, false, Time.SYSTEM);
              }));
  kafkaNamesMapper = new JsonToAvroMigrationKafkaNamesMapper(namespace);
}

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