[ https://issues.apache.org/jira/browse/KAFKA-2390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14708137#comment-14708137 ]
Dong Lin commented on KAFKA-2390: --------------------------------- [~nehanarkhede]Sure! Let me explain my understanding here. BTW, we have had extended discussion on this with [~hachikuji] and [~ewencp] at https://github.com/apache/kafka/pull/118 While seek() is meant to update an internal fetch position for use in the next poll(), users may not know this internal implementation fact and may expect seek() to be successfully applied after it returns. If the position in seek() is out of range, a default policy, e.g. latest, may be applied while leaving user unaware of this. We find it may be useful to give user the option of getting alerted when the position to seek is invalid. We also discussed whether we need callback in seek() if we have a listener for out-of-range exception. Here is a usecase where callback in seek() can be useful. I will copy&past it from github discussion: "An out-of-range exception can happen for one of the three reasons: 1) invalid offset in seek, 2) unclean leader election, and 3) consumer lags behind too much. One reasonable strategy that I envision is that, consumer will throw exception and quit for 1), reset offset to latest for 2), and reset offset to earliest for 3). Such a strategy can be implemented using a combination of ConsumerSeekCallback and ConsumerListener, but not with ConsumerListener alone." Does it make sense? Thanks for discussion. > Seek() should take a callback. > ------------------------------ > > Key: KAFKA-2390 > URL: https://issues.apache.org/jira/browse/KAFKA-2390 > Project: Kafka > Issue Type: Sub-task > Reporter: Jiangjie Qin > Assignee: Dong Lin > > Currently seek is an async call. To have the same interface as other calls > like commit(), seek() should take a callback. This callback will be invoked > if the position to seek triggers OFFSET_OUT_OF_RANGE exception from broker. -- This message was sent by Atlassian JIRA (v6.3.4#6332)