Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # user >> Re: a consumer question


Copy link to this message
-
Re: a consumer question
Jun is right. Just checked the code. If you set consumer.timeout.ms to 0
then if there is no message a ConsumerTimeoutException will be thrown right
away.
On Tue, Dec 17, 2013 at 9:08 PM, Jun Rao <[EMAIL PROTECTED]> wrote:

> Actually, hasNext() only returns false when the consumer connector is
> shutdown. Typically, you either set consumer.timeout.ms to -1 or a value
> larger than 0. If it's set to 0, my guess is that it throws a timeout
> exception immediately if there is no more message.
>
> Thanks,
>
> Jun
>
>
> On Tue, Dec 17, 2013 at 4:57 PM, Guozhang Wang <[EMAIL PROTECTED]> wrote:
>
> > If there is no more messages, hasNext will return false instead of
> throwing
> > an exception.
> >
> > Guozhang
> >
> >
> > On Tue, Dec 17, 2013 at 11:53 AM, Yu, Libo <[EMAIL PROTECTED]> wrote:
> >
> > > Sorry, a typo. Correct my question. When consumer.timeout.ms is set to
> > 0,
> > >  if there is no
> > > message available, hasNext() throws a timeout exception, otherwise it
> > > returns true.
> > > Is that the right behavior?
> > >
> > > Regards,
> > >
> > > Libo
> > >
> > >
> > > -----Original Message-----
> > > From: Jun Rao [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, December 17, 2013 12:40 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: a consumer question
> > >
> > > If there is a message, hasNext() returns true, not throwing an
> exception.
> > >
> > > Thanks,
> > >
> > > Jun
> > >
> > >
> > > On Mon, Dec 16, 2013 at 11:29 AM, Yu, Libo <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hi folks,
> > > >
> > > > For this parameters, if consumer.timeout.ms is set to 0, whenever I
> > > > call ConsumerIterator's hasNext(), if there is a message available, a
> > > > timeout exception will be thrown. Is my understanding correct?
> Thanks.
> > > >
> > > > consumer.timeout.ms
> > > >
> > > > -1
> > > >
> > > > Throw a timeout exception to the consumer if no message is available
> > > > for consumption after the specified interval
> > > >
> > > >
> > > >
> > > > Regards,
> > > >
> > > > Libo
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > -- Guozhang
> >
>

--
-- Guozhang

 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB