K
- the key type.V
- the value type.public class KafkaMessageListenerContainerSpec<K,V> extends IntegrationComponentSpec<KafkaMessageListenerContainerSpec<K,V>,org.springframework.kafka.listener.ConcurrentMessageListenerContainer<K,V>>
ConcurrentMessageListenerContainer
.PARSER, target
logger
DEFAULT_PHASE
OBJECT_TYPE_ATTRIBUTE
Modifier and Type | Method and Description |
---|---|
KafkaMessageListenerContainerSpec<K,V> |
ackCount(int count)
Set the number of outstanding record count after which offsets should be
committed when
ContainerProperties.AckMode#COUNT
or ContainerProperties.AckMode#COUNT_TIME is being used. |
KafkaMessageListenerContainerSpec<K,V> |
ackMode(org.springframework.kafka.listener.ContainerProperties.AckMode ackMode)
Set the ack mode to use when auto ack (in the configuration properties) is false.
|
KafkaMessageListenerContainerSpec<K,V> |
ackOnError(boolean ackOnError)
Deprecated.
in favor of
GenericErrorHandler.isAckAfterHandle() . |
KafkaMessageListenerContainerSpec<K,V> |
ackTime(long millis)
Set the time (ms) after which outstanding offsets should be committed when
ContainerProperties.AckMode#TIME or
ContainerProperties.AckMode#COUNT_TIME is being used. |
KafkaMessageListenerContainerSpec<K,V> |
commitCallback(org.apache.kafka.clients.consumer.OffsetCommitCallback commitCallback)
Set the commit callback; by default a simple logging callback is used to log
success at DEBUG level and failures at ERROR level.
|
KafkaMessageListenerContainerSpec<K,V> |
concurrency(int concurrency)
Specify a concurrency maximum number for the
AbstractMessageListenerContainer . |
KafkaMessageListenerContainerSpec<K,V> |
consumerRebalanceListener(org.apache.kafka.clients.consumer.ConsumerRebalanceListener consumerRebalanceListener)
Set the user defined
ConsumerRebalanceListener implementation. |
KafkaMessageListenerContainerSpec<K,V> |
consumerTaskExecutor(AsyncListenableTaskExecutor consumerTaskExecutor)
Set the executor for threads that poll the consumer.
|
KafkaMessageListenerContainerSpec<K,V> |
errorHandler(org.springframework.kafka.listener.GenericErrorHandler<?> errorHandler)
Specify an
ErrorHandler for the
AbstractMessageListenerContainer . |
KafkaMessageListenerContainerSpec<K,V> |
groupId(String groupId)
Set the group id for this container.
|
KafkaMessageListenerContainerSpec<K,V> |
id(String id)
Configure the component identifier.
|
KafkaMessageListenerContainerSpec<K,V> |
idleEventInterval(Long idleEventInterval)
Set the idle event interval; when set, an event is emitted if a poll returns
no records and this interval has elapsed since a record was returned.
|
KafkaMessageListenerContainerSpec<K,V> |
pollTimeout(long pollTimeout)
Set the max time to block in the consumer waiting for records.
|
KafkaMessageListenerContainerSpec<K,V> |
shutdownTimeout(long shutdownTimeout)
Set the timeout for shutting down the container.
|
KafkaMessageListenerContainerSpec<K,V> |
syncCommits(boolean syncCommits)
Set whether or not to call consumer.commitSync() or commitAsync() when the
container is responsible for commits.
|
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
public KafkaMessageListenerContainerSpec<K,V> id(String id)
IntegrationComponentSpec
beanName
to register the
bean in the application context for this component.id
in class IntegrationComponentSpec<KafkaMessageListenerContainerSpec<K,V>,org.springframework.kafka.listener.ConcurrentMessageListenerContainer<K,V>>
id
- the id.public KafkaMessageListenerContainerSpec<K,V> concurrency(int concurrency)
AbstractMessageListenerContainer
.concurrency
- the concurrency maximum number.ConcurrentMessageListenerContainer.setConcurrency(int)
public KafkaMessageListenerContainerSpec<K,V> errorHandler(org.springframework.kafka.listener.GenericErrorHandler<?> errorHandler)
ErrorHandler
for the
AbstractMessageListenerContainer
.errorHandler
- the ErrorHandler
.ErrorHandler
public KafkaMessageListenerContainerSpec<K,V> ackMode(org.springframework.kafka.listener.ContainerProperties.AckMode ackMode)
#setPollTimeout(long) pollTimeout
.AcknowledgingMessageListener
.
ackMode
- the ContainerProperties.AckMode
; default BATCH.ContainerProperties.AckMode
public KafkaMessageListenerContainerSpec<K,V> pollTimeout(long pollTimeout)
pollTimeout
- the timeout in ms; default 1000.ConsumerProperties.setPollTimeout(long)
public KafkaMessageListenerContainerSpec<K,V> ackCount(int count)
ContainerProperties.AckMode#COUNT
or ContainerProperties.AckMode#COUNT_TIME
is being used.count
- the countContainerProperties.setAckCount(int)
public KafkaMessageListenerContainerSpec<K,V> ackTime(long millis)
ContainerProperties.AckMode#TIME
or
ContainerProperties.AckMode#COUNT_TIME
is being used.
Should be larger than zero.millis
- the timeContainerProperties.setAckTime(long)
public KafkaMessageListenerContainerSpec<K,V> consumerTaskExecutor(AsyncListenableTaskExecutor consumerTaskExecutor)
consumerTaskExecutor
- the executorContainerProperties.setConsumerTaskExecutor(AsyncListenableTaskExecutor)
public KafkaMessageListenerContainerSpec<K,V> shutdownTimeout(long shutdownTimeout)
#stop(Runnable)
will block for, before
returning.shutdownTimeout
- the shutdown timeout.ContainerProperties.setShutdownTimeout(long)
public KafkaMessageListenerContainerSpec<K,V> consumerRebalanceListener(org.apache.kafka.clients.consumer.ConsumerRebalanceListener consumerRebalanceListener)
ConsumerRebalanceListener
implementation.consumerRebalanceListener
- the ConsumerRebalanceListener
instanceConsumerProperties.setConsumerRebalanceListener(ConsumerRebalanceListener)
public KafkaMessageListenerContainerSpec<K,V> commitCallback(org.apache.kafka.clients.consumer.OffsetCommitCallback commitCallback)
commitCallback
- the callback.ConsumerProperties.setCommitCallback(OffsetCommitCallback)
public KafkaMessageListenerContainerSpec<K,V> syncCommits(boolean syncCommits)
syncCommits
- true to use commitSync().ConsumerProperties.setSyncCommits(boolean)
public KafkaMessageListenerContainerSpec<K,V> idleEventInterval(Long idleEventInterval)
idleEventInterval
- the interval.ContainerProperties.setIdleEventInterval(Long)
@Deprecated public KafkaMessageListenerContainerSpec<K,V> ackOnError(boolean ackOnError)
GenericErrorHandler.isAckAfterHandle()
.ackOnError
- whether the container should acknowledge messages that throw
exceptions.ContainerProperties.setAckOnError(boolean)
public KafkaMessageListenerContainerSpec<K,V> groupId(String groupId)
group.id
property
provided by the consumer factory configuration.groupId
- the group id.ContainerProperties.setAckOnError(boolean)