kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiang Zhou (Samuel)" <zhou...@gmail.com>
Subject Re: How to fetch offset in SimpleConsumer using Java
Date Mon, 29 Jun 2015 18:10:24 GMT
Thank you for your response Noah. I just tried with the same groupId and
group name when I committed the offset, it still got the offset value -1
and error code 3(UnknownTopicOrPartition). But I could get
the TopicMetadataResponse for the topic and partition with this channel so
the error code 3 makes me confused. I noticed there are some messages saved
in __consumer_offsets when committing offsets. How could I check the
contents in topic __consumer_offsets to see if the content is correct there?

Thanks again!

On Mon, Jun 29, 2015 at 3:35 AM, noah <iamnoah@gmail.com> wrote:

> I believe clientGroup is your consumer group id. You must've picked a value
> to commit with, so it needs to be the same one.
>
> On Mon, Jun 29, 2015 at 12:50 AM Xiang Zhou (Samuel) <zhoux83@gmail.com>
> wrote:
>
> > Hi,
> >
> > I use the following snippets to try to get fetch the offset in a
> > SimpleConsumer I have committed (the commission has created topic
> > __consumer_offsets):
> >
> > fetchRequest = new OffsetFetchRequest(
> >
> >   clientGroup,  // What's the client group for simple consumer?
> >
> > partitions,
> >
> >   (short) 1 /* version */, // version 1 and above fetch from Kafka,
> version
> > 0 fetches from ZooKeeper
> >
> >   correlationId,
> >
> >   clientId);
> >
> >  channel.send(fetchRequest.underlying());
> >
> >  OffsetFetchResponse fetchResponse = OffsetFetchResponse.readFrom(channel
> > .receive().buffer());
> >
> > But it keeps getting offset with value -1 and error code 3(no such
> > topic/partition found). Does anybody know if it is possible to use
> > OffsetFetchRequest to get offset for simple consumer because it requires
> > client group? If it can, could anybody suggest me how to fetch it?
> >
> > Thanks!
> >
> > Samuel
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message