public class KafkaMessageListenerContainer
extends java.lang.Object
implements org.springframework.context.SmartLifecycle
| Modifier and Type | Class and Description |
|---|---|
class |
KafkaMessageListenerContainer.FetchTask
Fetches data from Kafka for a group of partitions, located on the same broker.
|
| Modifier and Type | Field and Description |
|---|---|
boolean |
autoStartup |
static int |
DEFAULT_WAIT_FOR_LEADER_REFRESH_RETRY |
static com.gs.collections.api.block.function.Function<java.util.Map.Entry<Partition,?>,Partition> |
keyFunction |
| Constructor and Description |
|---|
KafkaMessageListenerContainer(ConnectionFactory connectionFactory,
Partition... partitions) |
KafkaMessageListenerContainer(ConnectionFactory connectionFactory,
java.lang.String... topics) |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.Executor |
getAdminTaskExecutor() |
int |
getConcurrency() |
ErrorHandler |
getErrorHandler() |
java.util.concurrent.Executor |
getFetchTaskExecutor() |
int |
getMaxFetch() |
java.lang.Object |
getMessageListener() |
OffsetManager |
getOffsetManager() |
int |
getPhase() |
int |
getQueueSize() |
int |
getStopTimeout() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
setAdminTaskExecutor(java.util.concurrent.Executor adminTaskExecutor)
The task executor for leader and offset updates
|
void |
setAutoStartup(boolean autoStartup) |
void |
setConcurrency(int concurrency)
The maximum number of concurrent
MessageListeners running. |
void |
setDispatcherTaskExecutor(java.util.concurrent.Executor dispatcherTaskExecutor)
The task executor for invoking the MessageListener
|
void |
setErrorHandler(ErrorHandler errorHandler) |
void |
setFetchTaskExecutor(java.util.concurrent.Executor fetchTaskExecutor)
The task executor for fetch operations
|
void |
setMaxFetch(int maxFetch) |
void |
setMessageListener(java.lang.Object messageListener) |
void |
setOffsetManager(OffsetManager offsetManager) |
void |
setQueueSize(int queueSize)
The maximum number of messages that are buffered by each concurrent
MessageListener runner. |
void |
setStopTimeout(int stopTimeout)
The timeout for waiting for each concurrent
MessageListener to finish on stopping. |
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
public static final int DEFAULT_WAIT_FOR_LEADER_REFRESH_RETRY
public static final com.gs.collections.api.block.function.Function<java.util.Map.Entry<Partition,?>,Partition> keyFunction
public boolean autoStartup
public KafkaMessageListenerContainer(ConnectionFactory connectionFactory, Partition... partitions)
public KafkaMessageListenerContainer(ConnectionFactory connectionFactory, java.lang.String... topics)
public OffsetManager getOffsetManager()
public void setOffsetManager(OffsetManager offsetManager)
public java.lang.Object getMessageListener()
public void setMessageListener(java.lang.Object messageListener)
public ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
public int getConcurrency()
public void setConcurrency(int concurrency)
MessageListeners running. Messages from within the same
partition will be processed sequentially.concurrency - the concurrency maximum numberpublic void setStopTimeout(int stopTimeout)
MessageListener to finish on stopping.stopTimeout - timeout in millisecondspublic int getStopTimeout()
public java.util.concurrent.Executor getFetchTaskExecutor()
public void setFetchTaskExecutor(java.util.concurrent.Executor fetchTaskExecutor)
fetchTaskExecutor - the Executor for fetch operationspublic java.util.concurrent.Executor getAdminTaskExecutor()
public void setAdminTaskExecutor(java.util.concurrent.Executor adminTaskExecutor)
adminTaskExecutor - the task executor for leader and offset updates.public void setDispatcherTaskExecutor(java.util.concurrent.Executor dispatcherTaskExecutor)
dispatcherTaskExecutor - the task executor for invoking the MessageListenerpublic int getMaxFetch()
public int getQueueSize()
public void setQueueSize(int queueSize)
MessageListener runner.
Increasing the value may increase throughput, but also increases the memory consumption.
Must be a positive number and a power of 2.queueSize - the queue sizepublic void setMaxFetch(int maxFetch)
public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setAutoStartup(boolean autoStartup)
public void stop(java.lang.Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic int getPhase()
getPhase in interface org.springframework.context.Phased