K - the key type.V - the value type.public class ConcurrentMessageListenerContainer<K,V> extends AbstractMessageListenerContainer<K,V>
KafkaMessageListenerContainers based on
concurrency. If the
ConcurrentMessageListenerContainer(ConsumerFactory, TopicPartition...)
constructor is used, the TopicPartitions are distributed evenly across the
instances.AbstractMessageListenerContainer.AckModelogger| Constructor and Description |
|---|
ConcurrentMessageListenerContainer(ConsumerFactory<K,V> consumerFactory,
java.util.regex.Pattern topicPattern)
Construct an instance with the supplied configuration properties and topic
pattern.
|
ConcurrentMessageListenerContainer(ConsumerFactory<K,V> consumerFactory,
java.lang.String... topics)
Construct an instance with the supplied configuration properties and topics.
|
ConcurrentMessageListenerContainer(ConsumerFactory<K,V> consumerFactory,
org.apache.kafka.common.TopicPartition... topicPartitions)
Construct an instance with the supplied configuration properties and specific
topics/partitions - when using this constructor,
recentOffset can be specified. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart() |
protected void |
doStop() |
int |
getConcurrency() |
java.util.List<KafkaMessageListenerContainer<K,V>> |
getContainers()
Return the list of
KafkaMessageListenerContainers created by
this container. |
void |
setConcurrency(int concurrency)
The maximum number of concurrent
KafkaMessageListenerContainers running. |
void |
setRecentOffset(long recentOffset)
Set the offset to this number of records back from the latest when starting.
|
getAckCount, getAckMode, getAckTime, getBeanName, getErrorHandler, getMessageListener, getPhase, getPollTimeout, getTaskExecutor, isAutoStartup, isRunning, setAckCount, setAckMode, setAckTime, setAutoStartup, setBeanName, setErrorHandler, setMessageListener, setPhase, setPollTimeout, setRunning, setTaskExecutor, setupMessageListener, start, stop, stoppublic ConcurrentMessageListenerContainer(ConsumerFactory<K,V> consumerFactory, org.apache.kafka.common.TopicPartition... topicPartitions)
recentOffset can be specified.
The topic partitions are distributed evenly across the delegate
KafkaMessageListenerContainers.consumerFactory - the consumer factory.topicPartitions - the topics/partitions; duplicates are eliminated.public ConcurrentMessageListenerContainer(ConsumerFactory<K,V> consumerFactory, java.lang.String... topics)
recentOffset is
ignored.consumerFactory - the consumer factory.topics - the topics.public ConcurrentMessageListenerContainer(ConsumerFactory<K,V> consumerFactory, java.util.regex.Pattern topicPattern)
recentOffset is
ignored.consumerFactory - the consumer factory.topicPattern - the topic pattern.public void setRecentOffset(long recentOffset)
recentOffset - the offset from the latest; default 0.public int getConcurrency()
public void setConcurrency(int concurrency)
KafkaMessageListenerContainers running.
Messages from within the same partition will be processed sequentially.concurrency - the concurrency.public java.util.List<KafkaMessageListenerContainer<K,V>> getContainers()
KafkaMessageListenerContainers created by
this container.KafkaMessageListenerContainers created by
this container.protected void doStart()
doStart in class AbstractMessageListenerContainer<K,V>protected void doStop()
doStop in class AbstractMessageListenerContainer<K,V>