mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-02 11:37:50 +00:00
Add first producer test
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define CPPKAFKA_BUFFER_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
|
||||
namespace cppkafka {
|
||||
|
||||
@@ -11,6 +12,11 @@ public:
|
||||
|
||||
Buffer();
|
||||
Buffer(const DataType* data, size_t size);
|
||||
template <typename ForwardIterator>
|
||||
Buffer(const ForwardIterator& start, const ForwardIterator& end) :
|
||||
data_((const DataType*)&*start), size_(std::distance(start, end)) {
|
||||
|
||||
}
|
||||
|
||||
Buffer(const Buffer&) = delete;
|
||||
Buffer(Buffer&&) = default;
|
||||
@@ -19,8 +25,10 @@ public:
|
||||
|
||||
const DataType* get_data() const;
|
||||
size_t get_size() const;
|
||||
|
||||
std::string as_string() const;
|
||||
private:
|
||||
const unsigned char* data_;
|
||||
const DataType* data_;
|
||||
size_t size_;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@ public:
|
||||
using RebalanceErrorCallback = std::function<void(rd_kafka_resp_err_t)>;
|
||||
|
||||
Consumer(Configuration config);
|
||||
Consumer(const Consumer&) = delete;
|
||||
Consumer(Consumer&) = delete;
|
||||
Consumer& operator=(const Consumer&) = delete;
|
||||
Consumer& operator=(Consumer&&) = delete;
|
||||
~Consumer();
|
||||
|
||||
void set_timeout(const std::chrono::milliseconds timeout);
|
||||
void set_assignment_callback(AssignmentCallback callback);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace cppkafka {
|
||||
|
||||
class Message {
|
||||
public:
|
||||
Message();
|
||||
Message(rd_kafka_message_t* handle);
|
||||
Message(const Message&) = delete;
|
||||
Message(Message&& rhs) = default;
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include <memory>
|
||||
#include "kafka_handle_base.h"
|
||||
#include "configuration.h"
|
||||
#include "buffer.h"
|
||||
#include "topic.h"
|
||||
#include "partition.h"
|
||||
|
||||
namespace cppkafka {
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <librdkafka/rdkafka.h>
|
||||
#include "topic_partition.h"
|
||||
|
||||
@@ -15,6 +16,7 @@ public:
|
||||
static TopicPartitionList make_non_owning(rd_kafka_topic_partition_list_t* handle);
|
||||
|
||||
TopicPartitionList();
|
||||
TopicPartitionList(const std::initializer_list<TopicPartition>& topic_partitions);
|
||||
TopicPartitionList(rd_kafka_topic_partition_list_t* handle);
|
||||
TopicPartitionList(size_t size);
|
||||
template <typename ForwardIterator>
|
||||
|
||||
Reference in New Issue
Block a user