mfontanini / cppkafka

Modern C++ Apache Kafka client library (wrapper for librdkafka)
BSD 2-Clause "Simplified" License
589 stars 207 forks source link

consumer.get_offsets_committed fails for librdkafka >0.11.6 #233

Open olegabr opened 4 years ago

olegabr commented 4 years ago

Related to the #230

To reproduce, in the https://github.com/mfontanini/cppkafka/blob/master/examples/consumer_example.cpp#L76 example replace

consumer.subscribe({ topic_name });

with

int partition = 0;
cppkafka::TopicPartition initialPartition(topic_name, partition);
cout << "consumer.get_offsets_committed" << endl;
cppkafka::TopicPartitionList initialPL = consumer.get_offsets_committed(cppkafka::TopicPartitionList{initialPartition});
cppkafka::TopicPartition tp(topic_name, partition, initialPL[0].get_offset() + 1);
cppkafka::TopicPartitionList topicPartitionList_;
topicPartitionList_.push_back(tp);
cout << "consumer.assign" << endl;
consumer.assign(topicPartitionList_);

For librdkafka <= 0.11.6 it works just fine, but for newer versions it fails with a message:

$ ./consumer -b 127.0.0.1:9092 -t ethercscan.morden.blocks -g groupid3
consumer.get_offsets_committed
terminate called after throwing an instance of 'cppkafka::HandleException'
  what():  Local: Timed out
Aborted (core dumped)

kafka v2.3.0 cppkafka v0.3.1

olegabr commented 4 years ago

@mfontanini would appreciate you help