Yes, I have configured consumer timeout config.

Let me put my query other way. Is it possible that it.hasNext() could be blocked even when there are messages available, In which case using Consumer Timeout could help?

Thanks,
Rahul.

On Saturday 29 November 2014 09:56 PM, Jun Rao wrote:
By default, it.hasNext() blocks when there is no more message to consume.
So catching ConsumerTimeoutException doesn't make any difference. You only
need to handle ConsumerTimeoutException if you have customized the consumer
timeout config.

Thanks,

Jun

On Thu, Nov 27, 2014 at 7:48 AM, Rahul Amaram <rahul.ama...@vizury.com>
wrote:

Hi,

I am just wondering if the below snippet

ConsumerIterator<byte[], byte[]) it = ...

while (True)
     try {
         while (it.hasNext()) {
         ...
         ...
         ...
     } catch (ConsumerTimeoutException e) {
         // do nothing
     }
}

would be more robust than

while(it.hasNext()) {
...
...
...
}

i.e. by setting a consumer timeout, catching it and again just waiting for
the next message make it more robust?

Regards,
Rahul.


Reply via email to