1) correlationId is just a number that you get back in your reply. you
can safely set it to anything. If you have some kind of call identification
is your system that you want to trace through logs - this is what you would
use.

2) You can safely use any external offset management you like. just store
the latest offset you got back from kafka. You should handle the error case
when your stored last offset is no longer in kafka's log. ie should you
restart from oldest or latest  logs.

/svante

2015-06-01 10:08 GMT+02:00 luo.fucong <bayinam...@gmail.com>:

> 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!

Reply via email to