mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-27 07:03:32 +00:00
Add pause/resume partitions wrappers
This commit is contained in:
@@ -117,10 +117,4 @@ void Consumer::commit(const TopicPartitionList& topic_partitions, bool async) {
|
||||
check_error(error);
|
||||
}
|
||||
|
||||
void Consumer::check_error(rd_kafka_resp_err_t error) {
|
||||
if (error != RD_KAFKA_RESP_ERR_NO_ERROR) {
|
||||
throw HandleException(error);
|
||||
}
|
||||
}
|
||||
|
||||
} // cppkafka
|
||||
|
||||
@@ -17,6 +17,18 @@ KafkaHandleBase::KafkaHandleBase(rd_kafka_t* handle)
|
||||
|
||||
}
|
||||
|
||||
void KafkaHandleBase::pause_partitions(const TopicPartitionList& topic_partitions) {
|
||||
rd_kafka_resp_err_t error = rd_kafka_pause_partitions(get_handle(),
|
||||
topic_partitions.get_handle());
|
||||
check_error(error);
|
||||
}
|
||||
|
||||
void KafkaHandleBase::resume_partitions(const TopicPartitionList& topic_partitions) {
|
||||
rd_kafka_resp_err_t error = rd_kafka_resume_partitions(get_handle(),
|
||||
topic_partitions.get_handle());
|
||||
check_error(error);
|
||||
}
|
||||
|
||||
rd_kafka_t* KafkaHandleBase::get_handle() {
|
||||
return handle_.get();
|
||||
}
|
||||
@@ -41,4 +53,10 @@ Topic KafkaHandleBase::get_topic(const string& name, rd_kafka_topic_conf_t* conf
|
||||
return Topic(topic);
|
||||
}
|
||||
|
||||
void KafkaHandleBase::check_error(rd_kafka_resp_err_t error) {
|
||||
if (error != RD_KAFKA_RESP_ERR_NO_ERROR) {
|
||||
throw HandleException(error);
|
||||
}
|
||||
}
|
||||
|
||||
} // cppkafka
|
||||
|
||||
Reference in New Issue
Block a user