mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-24 05:34:51 +00:00
Add initial consumer code
This commit is contained in:
35
src/topic_partition.cpp
Normal file
35
src/topic_partition.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <librdkafka/rdkafka.h>
|
||||
#include "topic_partition.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace cppkafka {
|
||||
|
||||
TopicPartition::TopicPartition(const string& topic)
|
||||
: TopicPartition(topic, RD_KAFKA_PARTITION_UA) {
|
||||
|
||||
}
|
||||
|
||||
TopicPartition::TopicPartition(const string& topic, int partition)
|
||||
: TopicPartition(topic, partition, RD_KAFKA_OFFSET_INVALID) {
|
||||
|
||||
}
|
||||
|
||||
TopicPartition::TopicPartition(const string& topic, int partition, int64_t offset)
|
||||
: topic_(topic), partition_(partition), offset_(offset) {
|
||||
|
||||
}
|
||||
|
||||
const string& TopicPartition::get_topic() const {
|
||||
return topic_;
|
||||
}
|
||||
|
||||
int TopicPartition::get_partition() const {
|
||||
return partition_;
|
||||
}
|
||||
|
||||
int64_t TopicPartition::get_offset() const {
|
||||
return offset_;
|
||||
}
|
||||
|
||||
} // cppkafka
|
||||
Reference in New Issue
Block a user