public interface ConsumerListener<K,V>
Implement this interface to listen asynchronously to records using a Kafka consumer. By annotating the implementing
KafkaListener, the underlying consumer will be automatically subscribed to the specified topics.
The underlying Kafka consumer will be automatically started and stopped with the application. A unhandled failure will gracefully stop the consumer and a later attempt will be rescheduled.
If the implementing class also implements
will be used as the rebalance listener for the underlying consumer. If the implementing class also implements
OffsetCommitCallback, it will be used as a callback during the
|Modifier and Type||Method and Description|
This method is called when a
This method is called when some
This method is called when an exception occurs during consumer polling or message processing in
default void onConsumerRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
record- the record.
default void onConsumerRecords(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records)
records- the just-polled consumer records.
default void onException(Exception e) throws Exception
e- the exception that occurred.
Exception- rethrow an exception to trigger a graceful stop and a retry after the specified delay.
Copyright © 2013-2018–2019 SeedStack. All rights reserved.