You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Alex Melville <am...@g.hmc.edu> on 2015/04/15 09:09:09 UTC

Best Way to Check Producer's Connection to Kafka

Hi All,


What is the lightest way to check if the connection to Kafka is up or not?
Currently I'm having the producer attempt to send a message to a topic, and
then catching a TimeoutException and handling logic inside of the catch
statement. This doesn't seem like the right way to do this, though. Is
there a way to check if the connection is up without resorting to control
flow through Exceptions?

I'm using Kafka 0.8.2



Alex

Re: Best Way to Check Producer's Connection to Kafka

Posted by Andy Lindeman <an...@lindeman.io>.
On Apr 15, 2015, at 12:09 AM, Alex Melville <am...@g.hmc.edu> wrote:
> 
> Hi All,
> 
> What is the lightest way to check if the connection to Kafka is up or not?
> Currently I'm having the producer attempt to send a message to a topic, and
> then catching a TimeoutException and handling logic inside of the catch
> statement. This doesn't seem like the right way to do this, though. Is
> there a way to check if the connection is up without resorting to control
> flow through Exceptions?
> 
> I'm using Kafka 0.8.2

What's your use case in particular? Even if you check the status of the connection at some point in time, you'll also need to handle exceptions when you perform some other operation later because it may have failed since you last checked it.