mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2026-01-27 10:22:42 +00:00
Allow dumping all options in a configuration
This commit is contained in:
@@ -33,8 +33,6 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <chrono>
|
||||
#include <boost/optional.hpp>
|
||||
#include <librdkafka/rdkafka.h>
|
||||
@@ -149,6 +147,11 @@ public:
|
||||
*/
|
||||
std::string get(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* Gets all options, including default values which are set by rdkafka
|
||||
*/
|
||||
std::map<std::string, std::string> get_all() const;
|
||||
|
||||
/**
|
||||
* Gets the delivery report callback
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CPPKAFKA_CONFIGURATION_BASE_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
namespace cppkafka {
|
||||
|
||||
@@ -59,6 +60,14 @@ public:
|
||||
void set(const std::string& name, const char* value) {
|
||||
proxy_set(name, value);
|
||||
}
|
||||
protected:
|
||||
static std::map<std::string, std::string> parse_dump(const char** values, size_t count) {
|
||||
std::map<std::string, std::string> output;
|
||||
for (size_t i = 0; i < count; i += 2) {
|
||||
output[values[i]] = values[i + 1];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
private:
|
||||
void proxy_set(const std::string& name, const std::string& value) {
|
||||
static_cast<Concrete&>(*this).set(name, value);
|
||||
|
||||
@@ -109,6 +109,11 @@ public:
|
||||
*/
|
||||
std::string get(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* Gets all options, including default values which are set by rdkafka
|
||||
*/
|
||||
std::map<std::string, std::string> get_all() const;
|
||||
|
||||
/**
|
||||
* Gets the rdkafka handle
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user