mfontanini / cppkafka

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

Manual set offset but it not work? #256

Closed pingzilao closed 4 years ago

pingzilao commented 4 years ago

`cppkafka::Configuration config = { { "metadata.broker.list", "127.0.0.1:9092"}, { "enable.auto.commit", false }, { "fetch.wait.max.ms", 10}, { "group.id","test_group1"} };

auto consumer_ = std::make_shared< cppkafka::Consumer >(config); std::vector< cppkafka::TopicPartition > partitions; partitions.pushback(cppkafka::TopicPartition("topic1", 0, 352)); consumer->assign(partitions); auto tpl = consumer_->get_assignment(); std::cout<<"Begin offset|"<<tpl; //print is Begin offset|[ response_of_5[0:352] ]

consumer->subscribe({"topic1"}); while(true) { auto msg = consumer->poll() }

`

it is from the latest one, not from 352. I dont know why? is any problem in my code?

pingzilao commented 4 years ago

i found it. it can not use both assign and subscribe. so delete function of subscribe will ok!