CCDAK · Question #195
You are writing a producer application and need to ensure proper delivery. You configure the producer with acks level to all. Which two actions should you take to ensure proper error handling?…
The correct answer is A. Use a callback argument in 'producer.send()' where you check delivery status. C. Surround the call of 'producer.send()' with a try/catch block to catch 'KafkaException'. Using a callback in producer.send() allows you to check for delivery success or failure. Wrapping producer.send() in a try/catch block lets you handle KafkaException and any runtime errors during send.
Question
You are writing a producer application and need to ensure proper delivery. You configure the producer with acks level to all. Which two actions should you take to ensure proper error handling? (Choose two.)
Options
- AUse a callback argument in 'producer.send()' where you check delivery status.
- BCheck that 'producer.send()' retumed a 'RecordMetadata' object and is not null.
- CSurround the call of 'producer.send()' with a try/catch block to catch 'KafkaException'.
- DCheck the value of 'ProducerRecord status()'
How the community answered
(36 responses)- A83% (30)
- B6% (2)
- D11% (4)
Explanation
Using a callback in producer.send() allows you to check for delivery success or failure. Wrapping producer.send() in a try/catch block lets you handle KafkaException and any runtime errors during send.
Topics
Community Discussion
No community discussion yet for this question.