mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
				synced 2025-11-04 12:37:54 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			808 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			808 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef CPP_KAFKA_CONSUMER_H
 | 
						|
#define CPP_KAFKA_CONSUMER_H
 | 
						|
 | 
						|
#include <vector>
 | 
						|
#include <string>
 | 
						|
#include <chrono>
 | 
						|
#include "kafka_handle_base.h"
 | 
						|
#include "topic_partition_list.h"
 | 
						|
#include "message.h"
 | 
						|
 | 
						|
namespace cppkafka {
 | 
						|
 | 
						|
class Configuration;
 | 
						|
class TopicConfiguration;
 | 
						|
 | 
						|
class Consumer : public KafkaHandleBase {
 | 
						|
public:
 | 
						|
    Consumer(const Configuration& config);
 | 
						|
 | 
						|
    void set_timeout(const std::chrono::milliseconds timeout);
 | 
						|
 | 
						|
    void subscribe(const std::vector<std::string>& topics);
 | 
						|
    void unsubscribe();
 | 
						|
 | 
						|
    void assign(const TopicPartitionList& topic_partitions);
 | 
						|
 | 
						|
    Message poll();
 | 
						|
private:
 | 
						|
    static const std::chrono::milliseconds DEFAULT_TIMEOUT;
 | 
						|
 | 
						|
    void check_error(rd_kafka_resp_err_t error);
 | 
						|
 | 
						|
    std::chrono::milliseconds timeout_ms_;
 | 
						|
};
 | 
						|
 | 
						|
} // cppkafka
 | 
						|
 | 
						|
#endif // CPP_KAFKA_CONSUMER_H
 |