Tabnine Logo
AdminZkClient.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
kafka.zk.AdminZkClient
constructor

Best Java code snippets using kafka.zk.AdminZkClient.<init> (Showing top 6 results out of 315)

origin: apache/hive

/**
 * Override to set up your specific external resource.
 *
 * @throws Throwable if setup fails (which will disable {@code after}
 */
@Override protected void before() throws Throwable {
 // Start the ZK and the Broker
 LOG.info("init embedded Zookeeper");
 zkServer = new EmbeddedZookeeper();
 tmpLogDir = Files.createTempDirectory("kafka-log-dir-").toAbsolutePath();
 String zkConnect = "127.0.0.1:" + zkServer.port();
 LOG.info("init kafka broker");
 Properties brokerProps = new Properties();
 brokerProps.setProperty("zookeeper.connect", zkConnect);
 brokerProps.setProperty("broker.id", "0");
 brokerProps.setProperty("log.dir", tmpLogDir.toString());
 brokerProps.setProperty("listeners", "PLAINTEXT://" + BROKER_IP_PORT);
 brokerProps.setProperty("offsets.topic.replication.factor", "1");
 brokerProps.setProperty("transaction.state.log.replication.factor", "1");
 brokerProps.setProperty("transaction.state.log.min.isr", "1");
 KafkaConfig config = new KafkaConfig(brokerProps);
 kafkaServer = TestUtils.createServer(config, Time.SYSTEM);
 kafkaServer.startup();
 kafkaServer.zkClient();
 adminZkClient = new AdminZkClient(kafkaServer.zkClient());
 LOG.info("Creating kafka TOPIC [{}]", TOPIC);
 adminZkClient.createTopic(TOPIC, 1, 1, new Properties(), RackAwareMode.Disabled$.MODULE$);
}
origin: linkedin/kafka-monitor

void maybeAddPartitions(int minPartitionNum) {
 KafkaZkClient zkClient = KafkaZkClient.apply(_zkConnect, JaasUtils.isZkSecurityEnabled(), ZK_SESSION_TIMEOUT_MS,
   ZK_CONNECTION_TIMEOUT_MS, Integer.MAX_VALUE, Time.SYSTEM, METRIC_GROUP_NAME, "SessionExpireListener");
 AdminZkClient adminZkClient = new AdminZkClient(zkClient);
 try {
  scala.collection.Map<Object, scala.collection.Seq<Object>> existingAssignment = getPartitionAssignment(zkClient, _topic);
  int partitionNum = existingAssignment.size();
  if (partitionNum < minPartitionNum) {
   LOG.info("MultiClusterTopicManagementService will increase partition of the topic {} "
     + "in cluster {} from {} to {}.", _topic, _zkConnect, partitionNum, minPartitionNum);
   scala.Option<scala.collection.Map<java.lang.Object, scala.collection.Seq<java.lang.Object>>> replicaAssignment = scala.Option.apply(null);
   scala.Option<Seq<Object>> brokerList = scala.Option.apply(null);
   adminZkClient.addPartitions(_topic, existingAssignment, adminZkClient.getBrokerMetadatas(RackAwareMode.Disabled$.MODULE$, brokerList), minPartitionNum, replicaAssignment, false);
  }
 } finally {
  zkClient.close();
 }
}
origin: debezium/debezium

  server.startup();
  LOGGER.info("Started Kafka server {} at {} with storage in {}", brokerId, getConnection(), logsDir.getAbsolutePath());
  adminZkClient = new AdminZkClient(server.zkClient());
  return this;
} catch (RuntimeException e) {
origin: allegro/hermes

private AdminZkClient adminZkClient(KafkaZkClient kafkaZkClient) {
  return new AdminZkClient(kafkaZkClient);
}
origin: allegro/hermes

private void createTopic(String topicName, KafkaZkClient kafkaZkClient) {
  Topic topic = topic(topicName).build();
  kafkaNamesMapper.toKafkaTopics(topic).forEach(kafkaTopic -> {
    AdminZkClient adminZkClient = new AdminZkClient(kafkaZkClient);
    adminZkClient.createTopic(kafkaTopic.name().asString(), DEFAULT_PARTITIONS, DEFAULT_REPLICATION_FACTOR, new Properties(), RackAwareMode.Enforced$.MODULE$);
    waitAtMost(adjust(Duration.ONE_MINUTE)).until(() -> {
          kafkaZkClient.topicExists(kafkaTopic.name().asString());
        }
    );
  });
}
origin: pl.allegro.tech.hermes/hermes-test-helper

private void createTopic(String topicName, KafkaZkClient kafkaZkClient) {
  Topic topic = topic(topicName).build();
  kafkaNamesMapper.toKafkaTopics(topic).forEach(kafkaTopic -> {
    AdminZkClient adminZkClient = new AdminZkClient(kafkaZkClient);
    adminZkClient.createTopic(kafkaTopic.name().asString(), DEFAULT_PARTITIONS, DEFAULT_REPLICATION_FACTOR, new Properties(), RackAwareMode.Enforced$.MODULE$);
    waitAtMost(adjust(Duration.ONE_MINUTE)).until(() -> {
          kafkaZkClient.topicExists(kafkaTopic.name().asString());
        }
    );
  });
}
kafka.zkAdminZkClient<init>

Popular methods of AdminZkClient

  • createTopic
  • deleteTopic
  • addPartitions
  • changeTopicConfig
  • getBrokerMetadatas

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now