org.springframework.integration.kafka.util
Class TopicUtils

java.lang.Object
  extended by org.springframework.integration.kafka.util.TopicUtils

public class TopicUtils
extends java.lang.Object

Utilities for interacting with Kafka topics


Field Summary
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 Summary
TopicUtils()
           
 
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
 

Field Detail

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
Constructor Detail

TopicUtils

public TopicUtils()
Method Detail

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 instance
topicName - the name of the topic
numPartitions - the number of partitions
replicationFactor - 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 Zookeeper
topicName - the name of the topic
numPartitions - the number of partitions for the topic
topicConfig - additional topic configuration properties
replicaAssignment - the mapping of partitions to broker
Returns:
TopicMetadata information for the topic