You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
#ifndef __PROTOCOL_KAFKA_HEADER__
|
|
#define __PROTOCOL_KAFKA_HEADER__
|
|
|
|
#ifdef __linux__
|
|
#include <features.h>
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string>
|
|
#include <sys/timeb.h>
|
|
#include <sys/types.h>
|
|
#include <time.h>
|
|
// #include <librdkafka/rdkafka.h>
|
|
#include "../../components/base/basicLogCollection.h"
|
|
#include "../../components/base/basicSettingsProvider.h"
|
|
#include "protocolEuropeanGeneral.h"
|
|
|
|
#include <librdkafka/rdkafkacpp.h>
|
|
|
|
#ifdef DEBUG
|
|
#define DEBUG_KAFKA
|
|
#endif
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author gagua
|
|
*/
|
|
class protocolKAFKA : public RdKafka::DeliveryReportCb, public RdKafka::ConsumeCb, public RdKafka::EventCb
|
|
{
|
|
private:
|
|
|
|
basicLogCollection * m_pLog;
|
|
// config_setting_t * m_pSettings;
|
|
// rd_kafka_t * m_pKafka; /* Producer instance handle */
|
|
RdKafka::Consumer * m_pConsumer;
|
|
RdKafka::Producer * n_pProducer; /* Producer instance handle */
|
|
// rd_kafka_conf_t * m_pKafkaConf; /* Temporary configuration object */
|
|
// RdKafka::Conf * m_pKafkaConf; /* Temporary configuration object */
|
|
//---char m_pKafkaBrokerSTR[OS_CEP_ADDRESS_SIZE];
|
|
// CSTR m_pKafkaTopicSTR;
|
|
// RdKafka::Topic * m_pKafkaTopic;
|
|
KAFKA_SETTINGS * m_pSettings;
|
|
// CSTR m_pServerIP;
|
|
// int m_nServerPort;
|
|
public:
|
|
|
|
// Constructor
|
|
explicit protocolKAFKA(KAFKA_SETTINGS * Settings);
|
|
// explicit protocolKAFKA( CSTR ServerAddr, uint16_t Port );
|
|
// Destructor
|
|
virtual ~protocolKAFKA();
|
|
bool init();
|
|
bool issuePost(CSTR Channel, CSTR Buffer, int BufferSize);
|
|
bool receivePost(CSTR Channel, int32_t Partition, int64_t & Offset, CSTR Buffer, int & BufferSize);
|
|
/* Implementation of RdKafka::EventCb */
|
|
virtual void event_cb(RdKafka::Event & event);
|
|
virtual void consume_cb(RdKafka::Message & A, void * B);
|
|
/* Implementation of RdKafka::DeliveryReportCb */
|
|
virtual void dr_cb(RdKafka::Message & message);
|
|
};
|
|
|
|
#endif
|