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