Re: New consumer - offset one gets in poll is not offset one is supposed to commit

2015-07-28 Thread Jay Kreps
It seems less weird if you think of the offset as the position of the consumer, i.e. it is "on" record 5. In some sense the consumer is actually in between records, i.e. if it has processed 4 and not processed 5 do you think about your position as being on 4 or on 5? Well not on 4 because it alread

Re: New consumer - offset one gets in poll is not offset one is supposed to commit

2015-07-28 Thread tao xiao
Correct me if I m wrong. If compaction is used +1 to indicate next offset is no longer valid. For the compacted section the offset is not increasing sequentially. i think you need to call the next offset of the last processed record to figure out what the next offset will be On Wed, 29 Jul 2015 at

Re: New consumer - offset one gets in poll is not offset one is supposed to commit

2015-07-28 Thread Stevo Slavić
Hello Jason, Thanks for reply! About your proposal, in general case it might be helpful. In my case it will not help much - I'm allowing each ConsumerRecord or subset of ConsumerRecords to be processed and ACKed independently and out of HLC process/thread (not to block partition), and then commit

Re: New consumer - offset one gets in poll is not offset one is supposed to commit

2015-07-27 Thread Jason Gustafson
Hey Stevo, I agree that it's a little unintuitive that what you are committing is the next offset that should be read from and not the one that has already been read. We're probably constrained in that we already have a consumer which implements this behavior. Would it help if we added a method on

New consumer - offset one gets in poll is not offset one is supposed to commit

2015-07-24 Thread Stevo Slavić
Hello Apache Kafka community, Say there is only one topic with single partition and a single message on it. Result of calling a poll with new consumer will return ConsumerRecord for that message and it will have offset of 0. After processing message, current KafkaConsumer implementation expects o