org.springframework.integration.kafka.core
Class AbstractConfiguration

java.lang.Object
  extended by org.springframework.integration.kafka.core.AbstractConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, Configuration
Direct Known Subclasses:
BrokerAddressListConfiguration, ZookeeperConfiguration

public abstract class AbstractConfiguration
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean, Configuration

Default implementation of a Configuration, storing the default topic and partitions, as well as connectivity parameters. Implementors must provide a strategy for retrieving the seed brokers.


Constructor Summary
AbstractConfiguration()
           
 
Method Summary
 void afterPropertiesSet()
           
protected abstract  java.util.List<BrokerAddress> doGetBrokerAddresses()
           
 java.util.List<BrokerAddress> getBrokerAddresses()
          The list of seed broker addresses used by this Configuration.
 int getBufferSize()
          The buffer size for this client
 java.lang.String getClientId()
          The client name to be used throughout this connection.
 java.util.List<Partition> getDefaultPartitions()
          A list of default partitions to perform operations on.
 java.lang.String getDefaultTopic()
          A default topic to perform operations on.
 int getFetchMetadataTimeout()
          The timeout on fetching metadata (e.g.
 int getMaxWait()
          The maximum amount of time that a server fetch operation will wait before returning (unless minFetchSizeInBytes) are available.
 int getMinBytes()
          The minimum amount of data that a server fetch operation will wait for before returning, unless maxWait has elapsed.
 int getSocketTimeout()
          The socket timeout for this client
 void setBufferSize(int bufferSize)
          The buffer size for this client
 void setClientId(java.lang.String clientId)
          A client name to be used throughout this connection.
 void setDefaultPartitions(java.util.List<Partition> defaultPartitions)
           
 void setDefaultTopic(java.lang.String defaultTopic)
           
 void setFetchMetadataTimeout(int fetchMetadataTimeout)
          The timeout on fetching metadata (e.g.
 void setMaxWait(int maxWait)
          The maximum amount of time that a server fetch operation will wait before returning (unless minFetchSizeInBytes) are available.
 void setMinBytes(int minBytes)
          The minimum amount of data that a server fetch operation will wait for before returning, unless maxWait has elapsed.
 void setSocketTimeout(int socketTimeout)
          The socket timeout for this client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConfiguration

public AbstractConfiguration()
Method Detail

setMinBytes

public void setMinBytes(int minBytes)
The minimum amount of data that a server fetch operation will wait for before returning, unless maxWait has elapsed. In conjunction with Configuration.getMaxWait()}, controls latency and throughput. Smaller values increase responsiveness, but may increase the number of poll operations, potentially reducing throughput and increasing CPU consumption.

Parameters:
minBytes - the amount of data to fetch

getMinBytes

public int getMinBytes()
Description copied from interface: Configuration
The minimum amount of data that a server fetch operation will wait for before returning, unless maxWait has elapsed. In conjunction with Configuration.getMaxWait()}, controls latency and throughput. Smaller values increase responsiveness, but may increase the number of poll operations, potentially reducing throughput and increasing CPU consumption.

Specified by:
getMinBytes in interface Configuration
Returns:
the minimum amount of data for a fetch operation

setMaxWait

public void setMaxWait(int maxWait)
The maximum amount of time that a server fetch operation will wait before returning (unless minFetchSizeInBytes) are available. In conjunction with setMinBytes(int), controls latency and throughput. Smaller intervals increase responsiveness, but may increase the number of poll operations, potentially increasing CPU consumption and reducing throughput.

Parameters:
maxWait - timeout to wait

getMaxWait

public int getMaxWait()
Description copied from interface: Configuration
The maximum amount of time that a server fetch operation will wait before returning (unless minFetchSizeInBytes) are available. In conjunction with setMinBytes(int), controls latency and throughput. Smaller intervals increase responsiveness, but may increase the number of poll operations, potentially increasing CPU consumption and reducing throughput.

Specified by:
getMaxWait in interface Configuration
Returns:
the maximum wait time for a fetch operation

getClientId

public java.lang.String getClientId()
Description copied from interface: Configuration
The client name to be used throughout this connection.

Specified by:
getClientId in interface Configuration
Returns:
the client id for a connection

setClientId

public void setClientId(java.lang.String clientId)
A client name to be used throughout this connection.

Parameters:
clientId - the client name

getBufferSize

public int getBufferSize()
Description copied from interface: Configuration
The buffer size for this client

Specified by:
getBufferSize in interface Configuration
Returns:
the buffer size

setBufferSize

public void setBufferSize(int bufferSize)
The buffer size for this client

Parameters:
bufferSize - the buffer size

getSocketTimeout

public int getSocketTimeout()
Description copied from interface: Configuration
The socket timeout for this client

Specified by:
getSocketTimeout in interface Configuration
Returns:
the socket timeout

setSocketTimeout

public void setSocketTimeout(int socketTimeout)
The socket timeout for this client

Parameters:
socketTimeout - the socket timeout

setFetchMetadataTimeout

public void setFetchMetadataTimeout(int fetchMetadataTimeout)
The timeout on fetching metadata (e.g. partition leaders)

Parameters:
fetchMetadataTimeout - timeout

getFetchMetadataTimeout

public int getFetchMetadataTimeout()
Description copied from interface: Configuration
The timeout on fetching metadata (e.g. partition leaders)

Specified by:
getFetchMetadataTimeout in interface Configuration
Returns:
the fetch metadata timeout

getBrokerAddresses

public final java.util.List<BrokerAddress> getBrokerAddresses()
Description copied from interface: Configuration
The list of seed broker addresses used by this Configuration.

Specified by:
getBrokerAddresses in interface Configuration
Returns:
the broker addresses

getDefaultPartitions

public java.util.List<Partition> getDefaultPartitions()
Description copied from interface: Configuration
A list of default partitions to perform operations on.

Specified by:
getDefaultPartitions in interface Configuration
Returns:
the list of partitions

setDefaultPartitions

public void setDefaultPartitions(java.util.List<Partition> defaultPartitions)

getDefaultTopic

public java.lang.String getDefaultTopic()
Description copied from interface: Configuration
A default topic to perform operations on.

Specified by:
getDefaultTopic in interface Configuration
Returns:
a topic name

setDefaultTopic

public void setDefaultTopic(java.lang.String defaultTopic)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

doGetBrokerAddresses

protected abstract java.util.List<BrokerAddress> doGetBrokerAddresses()