Add initial consumer code

This commit is contained in:
Matias Fontanini
2016-05-21 19:31:24 -07:00
parent 61253e4f42
commit 4f50122393
10 changed files with 247 additions and 0 deletions

35
src/topic_partition.cpp Normal file
View 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