K
- the key type.V
- the value type.public class KafkaMessageListenerContainer<K,V> extends AbstractMessageListenerContainer<K,V>
Consumer
supporting
auto-partition assignment or user-configured assignment.
With the latter, initial partition offsets can be provided.
consumerFactory, DEFAULT_PHASE, lifecycleMonitor, logger
Constructor and Description |
---|
KafkaMessageListenerContainer(ConsumerFactory<? super K,? super V> consumerFactory,
ContainerProperties containerProperties)
Construct an instance with the supplied configuration properties.
|
KafkaMessageListenerContainer(ConsumerFactory<? super K,? super V> consumerFactory,
ContainerProperties containerProperties,
TopicPartitionOffset... topicPartitions)
Deprecated.
- the topicPartitions should be provided in the
ContainerProperties . |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop(java.lang.Runnable callback) |
java.util.Collection<org.apache.kafka.common.TopicPartition> |
getAssignedPartitions()
Return the
TopicPartition s currently assigned to this container,
either explicitly or by Kafka; may be null if not assigned yet. |
boolean |
isContainerPaused()
Return true if
MessageListenerContainer.pause() has been called; and all consumers in this container
have actually paused. |
java.util.Map<java.lang.String,java.util.Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric>> |
metrics()
Return metrics kept by this container's consumer(s), grouped by
client-id . |
protected AbstractMessageListenerContainer<?,?> |
parentOrThis()
Return this or a parent container if this has a parent.
|
void |
setClientIdSuffix(java.lang.String clientIdSuffix)
Set a suffix to add to the
client.id consumer property (if the consumer
factory supports it). |
void |
setEmergencyStop(java.lang.Runnable emergencyStop)
Set a
Runnable to call whenever an Error occurs on a listener
thread. |
java.lang.String |
toString() |
checkGroupId, checkTopics, createSimpleLoggingConsumerRebalanceListener, getAfterRollbackProcessor, getApplicationContext, getApplicationEventPublisher, getBeanName, getContainerProperties, getGenericErrorHandler, getGroupId, getListenerId, getPhase, getRecordInterceptor, isAutoStartup, isInterceptBeforeTx, isPaused, isPauseRequested, isRunning, pause, publishContainerStoppedEvent, resume, setAfterRollbackProcessor, setApplicationContext, setApplicationEventPublisher, setAutoStartup, setBatchErrorHandler, setBeanName, setErrorHandler, setGenericErrorHandler, setInterceptBeforeTx, setPhase, setRecordInterceptor, setRunning, setTopicCheckTimeout, setupMessageListener, start, stop, stop, stop
public KafkaMessageListenerContainer(ConsumerFactory<? super K,? super V> consumerFactory, ContainerProperties containerProperties)
consumerFactory
- the consumer factory.containerProperties
- the container properties.@Deprecated public KafkaMessageListenerContainer(ConsumerFactory<? super K,? super V> consumerFactory, ContainerProperties containerProperties, TopicPartitionOffset... topicPartitions)
ContainerProperties
.consumerFactory
- the consumer factory.containerProperties
- the container properties.topicPartitions
- the topics/partitions; duplicates are eliminated.public void setEmergencyStop(java.lang.Runnable emergencyStop)
Runnable
to call whenever an Error
occurs on a listener
thread.emergencyStop
- the Runnable.public void setClientIdSuffix(java.lang.String clientIdSuffix)
client.id
consumer property (if the consumer
factory supports it).clientIdSuffix
- the suffix to add.@Nullable public java.util.Collection<org.apache.kafka.common.TopicPartition> getAssignedPartitions()
TopicPartition
s currently assigned to this container,
either explicitly or by Kafka; may be null if not assigned yet.TopicPartition
s currently assigned to this container,
either explicitly or by Kafka; may be null if not assigned yet.public boolean isContainerPaused()
MessageListenerContainer
MessageListenerContainer.pause()
has been called; and all consumers in this container
have actually paused.public java.util.Map<java.lang.String,java.util.Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric>> metrics()
MessageListenerContainer
client-id
.client-id
Consumer.metrics()
protected void doStart()
doStart
in class AbstractMessageListenerContainer<K,V>
protected void doStop(java.lang.Runnable callback)
doStop
in class AbstractMessageListenerContainer<K,V>
protected AbstractMessageListenerContainer<?,?> parentOrThis()
AbstractMessageListenerContainer
parentOrThis
in class AbstractMessageListenerContainer<K,V>
public java.lang.String toString()
toString
in class java.lang.Object