Closed lopuhin closed 7 years ago
KafkaProducer.send returns a future. To resolve, try:
future = producer.send(topic, data) result = future.get(timeout=123)
Exception will be raised by get()
Right, I didn't notice it, thanks for making it clear! The exception does happen with get()
.
Still I think the error should be reported at least at WARN level.
@rajish I was facing same issue, i am thinking to use future.failed() method to check if it failed for this issue. I dnt think its going block the response till message is sent to kafka unlinke get method. @dpkp you can clarify this, is it okay to use failed method for this?
When trying to send a message that is larger than maximum allowed size (
max_request_size
argument of theKafkaProducer
), the message is silently dropped, and only debug logs show that is was dropped:The code that sends the message is just
I would expect an exception to be thrown. I'm new to kafka so I'm not sure if my expectations are reasonable.