public class TopicUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
METADATA_VERIFICATION_MAX_INTERVAL |
static int |
METADATA_VERIFICATION_RETRY_ATTEMPTS |
static double |
METADATA_VERIFICATION_RETRY_BACKOFF_MULTIPLIER |
static int |
METADATA_VERIFICATION_RETRY_INITIAL_INTERVAL |
static int |
METADATA_VERIFICATION_TIMEOUT |
Constructor and Description |
---|
TopicUtils() |
Modifier and Type | Method and Description |
---|---|
static kafka.api.TopicMetadata |
ensureTopicCreated(java.lang.String zkAddress,
java.lang.String topicName,
int numPartitions,
int replicationFactor)
Creates a topic in Kafka or validates that it exists with the requested number of partitions,
and returns only after the topic has been fully created
|
static kafka.api.TopicMetadata |
ensureTopicCreated(org.I0Itec.zkclient.ZkClient zkClient,
java.lang.String topicName,
int numPartitions,
java.util.Properties topicConfig,
scala.collection.Map<java.lang.Object,scala.collection.Seq<java.lang.Object>> replicaAssignment)
Creates a topic in Kafka and returns only after the topic has been fully and an produce metadata.
|
public static final int METADATA_VERIFICATION_TIMEOUT
public static final int METADATA_VERIFICATION_RETRY_ATTEMPTS
public static final double METADATA_VERIFICATION_RETRY_BACKOFF_MULTIPLIER
public static final int METADATA_VERIFICATION_RETRY_INITIAL_INTERVAL
public static final int METADATA_VERIFICATION_MAX_INTERVAL
public static kafka.api.TopicMetadata ensureTopicCreated(java.lang.String zkAddress, java.lang.String topicName, int numPartitions, int replicationFactor)
zkAddress
- the address of the Kafka ZooKeeper instancetopicName
- the name of the topicnumPartitions
- the number of partitionsreplicationFactor
- the replication factorTopicMetadata
information for the topicpublic static kafka.api.TopicMetadata ensureTopicCreated(org.I0Itec.zkclient.ZkClient zkClient, java.lang.String topicName, int numPartitions, java.util.Properties topicConfig, scala.collection.Map<java.lang.Object,scala.collection.Seq<java.lang.Object>> replicaAssignment)
zkClient
- an open ZkClient
connection to ZookeepertopicName
- the name of the topicnumPartitions
- the number of partitions for the topictopicConfig
- additional topic configuration propertiesreplicaAssignment
- the mapping of partitions to brokerTopicMetadata
information for the topic