Add partitioner callback to topic configuration

This commit is contained in:
Matias Fontanini
2016-06-04 19:15:32 -07:00
parent 8e37440f58
commit 4fccf277e0
7 changed files with 102 additions and 9 deletions

View File

@@ -5,11 +5,24 @@ using std::string;
namespace cppkafka {
void dummy_topic_destroyer(rd_kafka_topic_t*) {
}
Topic Topic::make_non_owning(rd_kafka_topic_t* handle) {
return Topic(handle, NonOwningTag{});
}
Topic::Topic(rd_kafka_topic_t* handle)
: handle_(handle, &rd_kafka_topic_destroy) {
}
Topic::Topic(rd_kafka_topic_t* handle, NonOwningTag)
: handle_(handle, &dummy_topic_destroyer) {
}
string Topic::get_name() const {
return rd_kafka_topic_name(handle_.get());
}