The underlining send runs in a different thread and doesn't block
producer.send(). One way I can think of to detect this is to set
block.on.buffer.full=false and catch BufferExhaustedException then check if
the broker is reachable. But this is an hacky way as BufferExhaustedException
may indicate other errors like buffer memory not enough.

On Fri, Mar 20, 2015 at 5:12 PM, Samuel Chase <samebch...@gmail.com> wrote:

> @Tao,
>
> On Fri, Mar 20, 2015 at 12:39 PM, tao xiao <xiaotao...@gmail.com> wrote:
> > You can set producer property retries not equal to 0. Details can be
> found
> > here
> > http://kafka.apache.org/documentation.html#newproducerconfigs
>
> I set "retries" to "1", but send is still blocking until the Kafka
> Server is reachable again.
>
> @Everyone,
>
> After successful initialization of the KafkaProducer, If Kafka becomes
> unreachable for a short while, any further sends wait indefinitely
> (when calling .get() on the future returned by .send()). Is there any
> way of detecting that Kafka is unreachable?
>
> Samuel
>



-- 
Regards,
Tao

Reply via email to