public class DefaultConnectionFactory extends java.lang.Object implements org.springframework.beans.factory.InitializingBean, ConnectionFactory, org.springframework.beans.factory.DisposableBean
ConnectionFactory| Modifier and Type | Field and Description |
|---|---|
static com.gs.collections.api.block.predicate.Predicate<kafka.javaapi.TopicMetadata> |
errorlessTopicMetadataPredicate |
| Constructor and Description |
|---|
DefaultConnectionFactory(Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
Connection |
connect(BrokerAddress brokerAddress)
Create a connection to a Kafka broker, caching it internally
|
void |
destroy() |
Configuration |
getConfiguration() |
BrokerAddress |
getLeader(Partition partition)
Return the leader for a single partition
|
java.util.Map<Partition,BrokerAddress> |
getLeaders(java.lang.Iterable<Partition> partitions)
Retrieve the leaders for a set of partitions.
|
java.util.Collection<Partition> |
getPartitions(java.lang.String topic)
Retrieves the partitions of a given topic
|
void |
refreshMetadata(java.util.Collection<java.lang.String> topics)
Refresh the cached metadata (i.e.
|
public static final com.gs.collections.api.block.predicate.Predicate<kafka.javaapi.TopicMetadata> errorlessTopicMetadataPredicate
public DefaultConnectionFactory(Configuration configuration)
public Configuration getConfiguration()
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic void destroy()
throws java.lang.Exception
destroy in interface org.springframework.beans.factory.DisposableBeanjava.lang.Exceptionpublic java.util.Map<Partition,BrokerAddress> getLeaders(java.lang.Iterable<Partition> partitions)
ConnectionFactorygetLeaders in interface ConnectionFactorypartitions - whose leaders are queriedConnectionFactory.getLeaders(Iterable)public BrokerAddress getLeader(Partition partition)
ConnectionFactorygetLeader in interface ConnectionFactorypartition - the partition whose leader is queriedConnectionFactory.getLeader(Partition)public Connection connect(BrokerAddress brokerAddress)
ConnectionFactoryconnect in interface ConnectionFactorybrokerAddress - a broker addressConnectionFactory.connect(BrokerAddress)public void refreshMetadata(java.util.Collection<java.lang.String> topics)
ConnectionFactoryrefreshMetadata in interface ConnectionFactorytopics - the topics for which to refresh the leadersConnectionFactory.refreshMetadata(Collection)public java.util.Collection<Partition> getPartitions(java.lang.String topic)
ConnectionFactorygetPartitions in interface ConnectionFactorytopic - the topic to query forConnectionFactory.getPartitions(String)