kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Lindeman <a...@lindeman.io>
Subject Re: Best Way to Check Producer's Connection to Kafka
Date Mon, 20 Apr 2015 00:22:02 GMT
On Apr 15, 2015, at 12:09 AM, Alex Melville <amelville@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.
Mime
View raw message