How does (should) Kafka Consumer cope with Poison

2019-04-28 04:20发布

问题:

When a Kafka Consumer fails to deserialize a message, is it the client applications responsibility to deal with the Poison Message?

Or

Does Kafka "increment" the message offset and continue consumption of valid messages?

Is there a "Best Practice" for dealing with Poison Messages held on Kafka topics?

回答1:

When Kafka is unable to deserialize the record the consumer will receive a org.apache.kafka.common.KafkaException, you should commit the offset yourself and keep consuming.