You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Stuart Reynolds <st...@stureynolds.com> on 2015/02/23 03:35:31 UTC

earliestOrLatestOffset, getOffsetsBefore

In


http://apache.osuosl.org/kafka/0.8.2-beta/scala-doc/index.html#kafka.consumer.SimpleConsumer

class SimpleConsumer:
    def earliestOrLatestOffset(topicAndPartition: TopicAndPartition,
earliestOrLatest: Long, consumerId:Int): Long

1) What's the consumerId? It doesn't seem to matter what value I put
here, nor do I understand why its needed (since the isn't the query
used to lookup the head and tail offsets -- aren't these properties
consumer-independent?)


Also

2) What's the difference between:

class SimpleConsumer:
    def earliestOrLatestOffset(topicAndPartition: TopicAndPartition,
earliestOrLatest: Long, consumerId:Int): Long
    def getOffsetsBefore(request: OffsetRequest): OffsetResponse

both of these method seem to return the head or tail offsets.

Thanks
- Stu

Re: earliestOrLatestOffset, getOffsetsBefore

Posted by Jun Rao <ju...@confluent.io>.
1) ConsumerId is for tracking which client makes the request. It's mostly
for debugging right now.

2) The latter is more general. You can ask for an offset before an
arbitrary timestamp.

Thanks,

Jun

On Sun, Feb 22, 2015 at 6:35 PM, Stuart Reynolds <st...@stureynolds.com>
wrote:

> In
>
>
>
> http://apache.osuosl.org/kafka/0.8.2-beta/scala-doc/index.html#kafka.consumer.SimpleConsumer
>
> class SimpleConsumer:
>     def earliestOrLatestOffset(topicAndPartition: TopicAndPartition,
> earliestOrLatest: Long, consumerId:Int): Long
>
> 1) What's the consumerId? It doesn't seem to matter what value I put
> here, nor do I understand why its needed (since the isn't the query
> used to lookup the head and tail offsets -- aren't these properties
> consumer-independent?)
>
>
> Also
>
> 2) What's the difference between:
>
> class SimpleConsumer:
>     def earliestOrLatestOffset(topicAndPartition: TopicAndPartition,
> earliestOrLatest: Long, consumerId:Int): Long
>     def getOffsetsBefore(request: OffsetRequest): OffsetResponse
>
> both of these method seem to return the head or tail offsets.
>
> Thanks
> - Stu
>