Re: Seek to invalid offset, new consumer

2016-03-07 Thread Guozhang Wang
Hi Giidox: Actually I just realized that position() call will trigger the underlying select() function when necessary, so your proposal above actually works. Guozhang On Mon, Mar 7, 2016 at 4:57 PM, Guozhang Wang wrote: > consumer.seekToBeginning / seekToEnd evaluates lazily, and hence you hav

Re: Seek to invalid offset, new consumer

2016-03-07 Thread Guozhang Wang
consumer.seekToBeginning / seekToEnd evaluates lazily, and hence you have to call poll in order to really update the fetching position. The first record's offset would then be the starting offset. Guozhang On Mon, Mar 7, 2016 at 4:53 AM, Giidox wrote: > Excellent, many thanks! > > With “auto.o

Re: Seek to invalid offset, new consumer

2016-03-07 Thread Giidox
Excellent, many thanks! With “auto.offset.reset” as “none”, I get OffsetOutOfRangeException, which is what I want. To find out how many messages the client I had missed, I called consumer.seekToBeginning and consumer.position (without calling poll). Is this a correct way to find out the first

Re: Seek to invalid offset, new consumer

2016-03-05 Thread Guozhang Wang
Hello, 1) When the fetch offset is out of range, broker will send back the corresponding error code and the new consumer should reset its offset automatically according to the reset policy (config "auto.offset.reset"), by default it is set to "latest", i.e. then log end offset. If you do not have