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.
AbstractMessageListenerContainer.AckModelogger| Constructor and Description |
|---|
KafkaMessageListenerContainer(ConsumerFactory<K,V> consumerFactory,
ContainerProperties containerProperties)
Construct an instance with the supplied configuration properties.
|
KafkaMessageListenerContainer(ConsumerFactory<K,V> consumerFactory,
ContainerProperties containerProperties,
TopicPartitionInitialOffset... topicPartitions)
Construct an instance with the supplied configuration properties and specific
topics/partitions/initialOffsets.
|
| 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
TopicPartitions currently assigned to this container,
either explicitly or by Kafka; may be null if not assigned yet. |
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. |
void |
setClientIdSuffix(java.lang.String clientIdSuffix)
Set a suffix to add to the
client.id consumer property (if the consumer
factory supports it). |
java.lang.String |
toString() |
createConsumerRebalanceListener, getApplicationEventPublisher, getBeanName, getContainerProperties, getPhase, isAutoStartup, isRunning, setApplicationEventPublisher, setAutoStartup, setBeanName, setPhase, setRunning, setupMessageListener, start, stop, stoppublic KafkaMessageListenerContainer(ConsumerFactory<K,V> consumerFactory, ContainerProperties containerProperties)
consumerFactory - the consumer factory.containerProperties - the container properties.public KafkaMessageListenerContainer(ConsumerFactory<K,V> consumerFactory, ContainerProperties containerProperties, TopicPartitionInitialOffset... topicPartitions)
consumerFactory - the consumer factory.containerProperties - the container properties.topicPartitions - the topics/partitions; duplicates are eliminated.public void setClientIdSuffix(java.lang.String clientIdSuffix)
client.id consumer property (if the consumer
factory supports it).clientIdSuffix - the suffix to add.public java.util.Collection<org.apache.kafka.common.TopicPartition> getAssignedPartitions()
TopicPartitions currently assigned to this container,
either explicitly or by Kafka; may be null if not assigned yet.TopicPartitions currently assigned to this container,
either explicitly or by Kafka; may be null if not assigned yet.public java.util.Map<java.lang.String,java.util.Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric>> metrics()
MessageListenerContainerclient-id.client-idConsumer.metrics()protected void doStart()
doStart in class AbstractMessageListenerContainer<K,V>protected void doStop(java.lang.Runnable callback)
doStop in class AbstractMessageListenerContainer<K,V>public java.lang.String toString()
toString in class java.lang.Object