I am trying to understand the relationship between setting the producer to retry failures and any exceptions received in the callback of the new producer API.
Using Kafka 0.8.2.1
Specifically, using the config defined by ProducerConfig.RETRIES_CONFIG
We're running Kafka 0.8.2.1
The code mimics the API documentation. Simple async producer with a callback
producer.send(record, new Callback {
override def onCompletion(recordMetadata: RecordMetadata, e: Exception): Unit = {
if (e != null) {
e.printStackTrace()
}
println(s"SENT: $datum Part: ${recordMetadata.partition()} Offset : ${recordMetadata.offset()}")
}
})
The question is: What role does the producer send retries, if any, play in case an exception is received in the callback? Here's a sample exception that we are having problems with running 0.8.2.1 inside docker:
org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server does not host this topic-partition
This is what the e.printStackTrace() prints and the producer simply moves on even though the retries and retry backoff are set high enough to allow for a resend.
What are the scenarios where the producer would indeed retry sending the message?
If this is indeed a scenario the producer auto retry logic does not cover, any recommendations for implementing that as part of the callback?
Thanks!
We have not had any luck getting Kafka 0.8.2.1 to behave well on broker restarts when run inside of docker. Have tried manually assigning partitions to other brokers before shutdown. Still results in loss of messages produced by the producer and
the retries setting doesn't seem to be doing much. Always get exceptions in the callback and that particular message would be "lost".