Closed pingzilao closed 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?
i found it. it can not use both assign and subscribe. so delete function of subscribe will ok!
`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?