K - the type of key for records consumed from KafkaV - the type of value for records consumed from Kafkapublic interface ConsumerRecordHandler<K,V>
| Modifier and Type | Method and Description |
|---|---|
void |
handleRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Handle a
ConsumerRecord consumed from Kafka broker. |
void handleRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
ConsumerRecord consumed from Kafka broker.
For the sake of fail fast, if any exception throws from this method, the thread for fetching records from Kafka broker will exit with an error message. This will trigger rebalances of partitions among all the consumer groups this consumer joined and let other consumer try to handle the failed and the following records.
You can consider to use RetriableConsumerRecordHandler to retry handling process automatically.
Or use CatchAllExceptionConsumerRecordHandler as a safety net to handle all the failed records in
the same way.
record - the consumed ConsumerRecordCopyright © 2020 LeanCloud. All rights reserved.