Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does (should) Kafka Consumer cope with Poison Messages

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?

like image 467
Hector Avatar asked Mar 14 '16 15:03

Hector


People also ask

How does Kafka deal with consumer failure?

ERROR HANDLING IN CONSUMER Consumer is trying to consume data from Kafka topic but the connection to broker is not established because broker is not available. In that case, consumer should retry to consume data within some time intervals. Kafka records are stored in the topics.

How do consumers consumes messages in Kafka?

Consumers work in groups to read data from Kafka topics. Consumers within a group are responsible for reading a portion of the messages (partitions) so that messages can be consumed in parallel. Consumers "pull" messages from Kafka. Kafka just sits there while consumer applications simultaneously read the same data.

How do you ensure consumers receive messages in the correct order with Kafka?

How to Ensure the Order of Messages. In Kafka, order can only be guaranteed within a partition. This means that if messages were sent from the producer in a specific order, the broker will write them to a partition and all consumers will read from that in the same order.

How can Kafka consumer improve performance?

Increasing the number of partitions and the number of brokers in a cluster will lead to increased parallelism of message consumption, which in turn improves the throughput of a Kafka cluster; however, the time required to replicate data across replica sets will also increase.


1 Answers

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.

like image 89
Nautilus Avatar answered Jan 04 '23 14:01

Nautilus