Spring Integration Kafka Support

org.springframework.integration.kafka.listener
Class KafkaMessageListenerContainer

java.lang.Object
  extended by org.springframework.integration.kafka.listener.KafkaMessageListenerContainer
All Implemented Interfaces:
org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public class KafkaMessageListenerContainer
extends java.lang.Object
implements org.springframework.context.SmartLifecycle

Author:
Marius Bogoevici

Nested Class Summary
 class KafkaMessageListenerContainer.FetchTask
          Fetches data from Kafka for a group of partitions, located on the same broker.
 
Field Summary
 boolean autoStartup
           
static com.gs.collections.api.block.function.Function<java.util.Map.Entry<Partition,?>,Partition> keyFunction
           
 
Constructor Summary
KafkaMessageListenerContainer(ConnectionFactory connectionFactory, Partition... partitions)
           
KafkaMessageListenerContainer(ConnectionFactory connectionFactory, java.lang.String... topics)
           
 
Method Summary
 java.util.concurrent.Executor getAdminTaskExecutor()
           
 int getConcurrency()
           
 ErrorHandler getErrorHandler()
           
 java.util.concurrent.Executor getFetchTaskExecutor()
           
 int getMaxFetch()
           
 MessageListener getMessageListener()
           
 OffsetManager getOffsetManager()
           
 int getPhase()
           
 int getQueueSize()
           
 boolean isAutoStartup()
           
 boolean isRunning()
           
 void setAdminTaskExecutor(java.util.concurrent.Executor adminTaskExecutor)
           
 void setAutoStartup(boolean autoStartup)
           
 void setConcurrency(int concurrency)
          The maximum number of concurrent MessageListeners running.
 void setErrorHandler(ErrorHandler errorHandler)
           
 void setFetchTaskExecutor(java.util.concurrent.Executor fetchTaskExecutor)
          The task executor for fetch operations
 void setMaxFetch(int maxFetch)
           
 void setMessageListener(MessageListener messageListener)
           
 void setOffsetManager(OffsetManager offsetManager)
           
 void setQueueSize(int queueSize)
          The maximum number of messages that are buffered by each concurrent MessageListener runner.
 void start()
           
 void stop()
           
 void stop(java.lang.Runnable callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyFunction

public static final com.gs.collections.api.block.function.Function<java.util.Map.Entry<Partition,?>,Partition> keyFunction

autoStartup

public boolean autoStartup
Constructor Detail

KafkaMessageListenerContainer

public KafkaMessageListenerContainer(ConnectionFactory connectionFactory,
                                     Partition... partitions)

KafkaMessageListenerContainer

public KafkaMessageListenerContainer(ConnectionFactory connectionFactory,
                                     java.lang.String... topics)
Method Detail

getOffsetManager

public OffsetManager getOffsetManager()

setOffsetManager

public void setOffsetManager(OffsetManager offsetManager)

getMessageListener

public MessageListener getMessageListener()

setMessageListener

public void setMessageListener(MessageListener messageListener)

getErrorHandler

public ErrorHandler getErrorHandler()

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)

getConcurrency

public int getConcurrency()

setConcurrency

public void setConcurrency(int concurrency)
The maximum number of concurrent MessageListeners running. Messages from within the same partition will be processed sequentially.

Parameters:
concurrency - the concurrency maximum number

getFetchTaskExecutor

public java.util.concurrent.Executor getFetchTaskExecutor()

setFetchTaskExecutor

public void setFetchTaskExecutor(java.util.concurrent.Executor fetchTaskExecutor)
The task executor for fetch operations

Parameters:
fetchTaskExecutor - the Executor for fetch operations

getAdminTaskExecutor

public java.util.concurrent.Executor getAdminTaskExecutor()
Returns:
the task executor for leader and offset updates.

setAdminTaskExecutor

public void setAdminTaskExecutor(java.util.concurrent.Executor adminTaskExecutor)

getMaxFetch

public int getMaxFetch()
Returns:
the maximum amount of data (in bytes) that pollers will fetch in one round

getQueueSize

public int getQueueSize()

setQueueSize

public void setQueueSize(int queueSize)
The maximum number of messages that are buffered by each concurrent MessageListener runner. Increasing the value may increase throughput, but also increases the memory consumption.

Parameters:
queueSize - the queue size

setMaxFetch

public void setMaxFetch(int maxFetch)

isAutoStartup

public boolean isAutoStartup()
Specified by:
isAutoStartup in interface org.springframework.context.SmartLifecycle

setAutoStartup

public void setAutoStartup(boolean autoStartup)

stop

public void stop(java.lang.Runnable callback)
Specified by:
stop in interface org.springframework.context.SmartLifecycle

start

public void start()
Specified by:
start in interface org.springframework.context.Lifecycle

stop

public void stop()
Specified by:
stop in interface org.springframework.context.Lifecycle

isRunning

public boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle

getPhase

public int getPhase()
Specified by:
getPhase in interface org.springframework.context.Phased

Spring Integration Kafka Support