mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-10-31 18:47:48 +00:00
Add metadata objects and tests for them
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <chrono>
|
||||
#include <librdkafka/rdkafka.h>
|
||||
#include "topic_partition_list.h"
|
||||
#include "metadata.h"
|
||||
|
||||
namespace cppkafka {
|
||||
|
||||
@@ -22,9 +24,14 @@ public:
|
||||
void pause_partitions(const TopicPartitionList& topic_partitions);
|
||||
void resume_partitions(const TopicPartitionList& topic_partitions);
|
||||
|
||||
void set_timeout(const std::chrono::milliseconds& timeout);
|
||||
|
||||
rd_kafka_t* get_handle();
|
||||
Topic get_topic(const std::string& name);
|
||||
Topic get_topic(const std::string& name, TopicConfiguration config);
|
||||
Metadata get_metadata();
|
||||
Metadata get_metadata(const Topic& topic);
|
||||
std::chrono::milliseconds get_timeout() const;
|
||||
protected:
|
||||
KafkaHandleBase();
|
||||
KafkaHandleBase(rd_kafka_t* handle);
|
||||
@@ -32,11 +39,15 @@ protected:
|
||||
void set_handle(rd_kafka_t* handle);
|
||||
void check_error(rd_kafka_resp_err_t error);
|
||||
private:
|
||||
static const std::chrono::milliseconds DEFAULT_TIMEOUT;
|
||||
|
||||
using HandlePtr = std::unique_ptr<rd_kafka_t, decltype(&rd_kafka_destroy)>;
|
||||
|
||||
Topic get_topic(const std::string& name, rd_kafka_topic_conf_t* conf);
|
||||
Metadata get_metadata(rd_kafka_topic_t* topic_ptr);
|
||||
|
||||
HandlePtr handle_;
|
||||
std::chrono::milliseconds timeout_ms_;
|
||||
};
|
||||
|
||||
} // cppkafka
|
||||
|
||||
Reference in New Issue
Block a user