mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-06 13:38:13 +00:00
Remove zookeeper support
This commit is contained in:
@@ -31,9 +31,6 @@
|
||||
#include "exceptions.h"
|
||||
#include "topic.h"
|
||||
#include "topic_partition_list.h"
|
||||
#ifdef CPPKAFKA_HAVE_ZOOKEEPER
|
||||
#include "zookeeper/zookeeper_pool.h"
|
||||
#endif // CPPKAFKA_HAVE_ZOOKEEPER
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
@@ -126,32 +123,6 @@ const Configuration& KafkaHandleBase::get_configuration() const {
|
||||
|
||||
void KafkaHandleBase::set_handle(rd_kafka_t* handle) {
|
||||
handle_ = HandlePtr(handle, &rd_kafka_destroy);
|
||||
|
||||
#ifdef CPPKAFKA_HAVE_ZOOKEEPER
|
||||
|
||||
if (config_.has_property("zookeeper")) {
|
||||
string endpoint = config_.get("zookeeper");
|
||||
milliseconds timeout = ZookeeperWatcher::DEFAULT_RECEIVE_TIMEOUT;
|
||||
if (config_.has_property("zookeeper.receive.timeout.ms")) {
|
||||
try {
|
||||
timeout = milliseconds(stoi(config_.get("zookeeper.receive.timeout.ms")));
|
||||
}
|
||||
catch (exception&) {
|
||||
throw ZookeeperException("Invalid zookeeper receive timeout");
|
||||
}
|
||||
}
|
||||
auto& pool = ZookeeperPool::instance();
|
||||
auto callback = [&](const string& brokers) {
|
||||
// Add the brokers and poll
|
||||
rd_kafka_brokers_add(handle_.get(), brokers.data());
|
||||
rd_kafka_poll(handle_.get(), 10);
|
||||
};
|
||||
ZookeeperSubscription subscriber = pool.subscribe(endpoint, timeout, callback);
|
||||
zookeeper_subscription_.reset(new ZookeeperSubscription(move(subscriber)));
|
||||
callback(pool.get_brokers(endpoint));
|
||||
}
|
||||
|
||||
#endif // CPPKAFKA_HAVE_ZOOKEEPER
|
||||
}
|
||||
|
||||
Topic KafkaHandleBase::get_topic(const string& name, rd_kafka_topic_conf_t* conf) {
|
||||
|
||||
Reference in New Issue
Block a user