Add initial producer code

This commit is contained in:
Matias Fontanini
2016-05-16 20:46:08 -07:00
parent f86c9c1f57
commit 1cc8f027c9
18 changed files with 359 additions and 13 deletions

View File

@@ -23,6 +23,7 @@ TopicConfiguration::TopicConfiguration(const TopicConfiguration& rhs)
TopicConfiguration& TopicConfiguration::operator=(const TopicConfiguration& rhs) {
handle_.reset(rd_kafka_topic_conf_dup(rhs.handle_.get()));
return *this;
}
void TopicConfiguration::set(const string& name, const string& value) {
@@ -31,10 +32,14 @@ void TopicConfiguration::set(const string& name, const string& value) {
result = rd_kafka_topic_conf_set(handle_.get(), name.data(), value.data(), error_buffer,
sizeof(error_buffer));
if (result != RD_KAFKA_CONF_OK) {
throw KafkaConfigException(name, error_buffer);
throw ConfigException(name, error_buffer);
}
}
rd_kafka_topic_conf_t* TopicConfiguration::get_handle() const {
return handle_.get();
}
TopicConfiguration::HandlePtr TopicConfiguration::make_handle(rd_kafka_topic_conf_t* ptr) {
return HandlePtr(ptr, &rd_kafka_topic_conf_destroy);
}