You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Jochen Mader <jo...@codecentric.de> on 2015/02/23 22:24:47 UTC

commit offset using SimpleConsumer

I am trying to manually commit offsets using the SimpleConsumer (Kafka
0.8.2 on JDK 8).

Using the following code:
offsets.put(new TopicAndPartition(cd.getTopic(), cd.getPartition())
        , new OffsetAndMetadata(messageAndOffset.offset(), "", -1L));

OffsetCommitRequest ocRequest = new OffsetCommitRequest("test-group"
        , offsets, correlationId.incrementAndGet(), consumer.clientId(),
(short)1);
OffsetCommitResponse offsetCommitResponse =
consumer.commitOffsets(ocRequest);

Looking into the Kafka logs I see:
[2015-02-23 22:20:26,624] WARN [KafkaApi-0] Produce request with
correlation id 9 from client Client_top1_0 on partition
[__consumer_offsets,12] failed due to Partition [__consumer_offsets,12]
doesn't exist on 0 (kafka.server.KafkaApis)

I know that __consumer_offsets is used by Kafka to store offsets and I
guess it should be created automatically. What am I doing wrong here?

Thanks,
Jochen
-- 
Jochen Mader | Lead IT Consultant

codecentric AG | Elsenheimerstr. 55a | 80687 München | Deutschland
tel: +49 89 215486633 | fax: +49 89 215486699 | mobil: +49 152 51862390
www.codecentric.de | blog.codecentric.de | www.meettheexperts.de |
www.more4fi.de

Sitz der Gesellschaft: Düsseldorf | HRB 63043 | Amtsgericht Düsseldorf
Vorstand: Michael Hochgürtel . Mirko Novakovic . Rainer Vehns
Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger . Jürgen Schütz