Yonghui, You can use ZookeeperConsumerConnector.commitOffsets() to commit arbitrary offsets, but be careful using it to seek forward / backward: you need to make sure everyone reads the committed offsets right after it is written (e.g. force a rebalance), and no one else override it beforehand.
KafkaConsumer.seek() will only allow seeking on the assigned partitions, and requires no coordination between consumers, hence is lighter-weight. Guozhang On Thu, Nov 19, 2015 at 1:15 AM, Yonghui Zhao <zhaoyong...@gmail.com> wrote: > Hi, > > I found in 0.9, > > def commitOffsets(offsetsToCommit: java.util.Map[TopicAndPartition, > OffsetAndMetadata], retryOnFailure: Boolean) > is added to ZookeeperConsumerConnector. > > > If I want to read data backwards or forwards, can I use this API to commit > new offset and then read data from new offset? > > > This api has same effect as Seek in KafkaConsumer? > > > In 0.8.1.1, there is no such api. If we don't > > I think I can implement this feature by simply rewriting partition consumer > offset on zk, right? > -- -- Guozhang