kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "luo.fucong" <bayinam...@gmail.com>
Subject How to correctly handle offsets?
Date Mon, 01 Jun 2015 08:08:13 GMT
Hi all:

I am using Kafka 0.8.2 and SimpleConsumer in maven:

<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.11</artifactId>
    <version>0.8.2.1</version>
</dependency>

I follow the SimpleConsumer example in the wiki, and there are some questions:

1. There seems lacking of how to commit the offset to Kafka. As far as I google it, it seems
that I should use the OffsetCommitRequest. However, like a thread that posted in this email
group several months ago, I am also very confused with the parameter “correlationId” in
the constructor of OffsetCommitRequest.

2. Maybe there are another way of doing the offset management. I am thinking store the offset
to Redis. If the offset is just a long number that indicating the “offset” in the partition,
and has nothing else tricky (like truncated at sometime or someplace), I suppose it’s doable,
is it?

3. I really want to know what’s the formally and officially recommended way to handle the
offset. Without using the High Level Consumers.

Thank you very much!
Mime
View raw message