You can set producer property retries not equal to 0. Details can be found here http://kafka.apache.org/documentation.html#newproducerconfigs
On Fri, Mar 20, 2015 at 3:01 PM, Samuel Chase <samebch...@gmail.com> wrote: > Hello Everyone, > > In the the new Java Producer API, the Callback code in > KafkaProducer.send is run after there is a response from the Kafka > server. This can be used if some error handling needs to be done based > on the response. > > When using the new Java Kafka Producer, I've noticed that when the > Kafka server is down/unreachable, KafkaProducer.send blocks until the > Kafka server is back up again. > > We've been using the older Scala Producer and when Kafka is > unreachable it throws an exception after a few retries. This exception > is caught and then some error handling code is run. > > - What is the recommended way of using the new Java Producer API to > handle the case where Kafka is unreachable temporarily? > > I don't want to wait until it is reachable again before I know that > the send failed. > > Any help, advice shall be much appreciated. > > Thanks, > > Samuel > -- Regards, Tao