org.springframework.integration.kafka.util
Class TopicUtils
java.lang.Object
org.springframework.integration.kafka.util.TopicUtils
public class TopicUtils
- extends java.lang.Object
Utilities for interacting with Kafka topics
Method Summary |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
METADATA_VERIFICATION_TIMEOUT
public static final int METADATA_VERIFICATION_TIMEOUT
- See Also:
- Constant Field Values
METADATA_VERIFICATION_RETRY_ATTEMPTS
public static final int METADATA_VERIFICATION_RETRY_ATTEMPTS
- See Also:
- Constant Field Values
METADATA_VERIFICATION_RETRY_BACKOFF_MULTIPLIER
public static final double METADATA_VERIFICATION_RETRY_BACKOFF_MULTIPLIER
- See Also:
- Constant Field Values
METADATA_VERIFICATION_RETRY_INITIAL_INTERVAL
public static final int METADATA_VERIFICATION_RETRY_INITIAL_INTERVAL
- See Also:
- Constant Field Values
METADATA_VERIFICATION_MAX_INTERVAL
public static final int METADATA_VERIFICATION_MAX_INTERVAL
- See Also:
- Constant Field Values
TopicUtils
public TopicUtils()
ensureTopicCreated
public 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
- Parameters:
zkAddress
- the address of the Kafka ZooKeeper instancetopicName
- the name of the topicnumPartitions
- the number of partitionsreplicationFactor
- the replication factor
- Returns:
TopicMetadata
information for the topic
ensureTopicCreated
public 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.
- Parameters:
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 broker
- Returns:
TopicMetadata
information for the topic