#ifndef QKAFKACONSUMER_H
#define QKAFKACONSUMER_H

#include <QThread>

#include "include/librdkafka/rdkafkacpp.h"

class QKafkaConsumer : public QThread
{
    Q_OBJECT
public:
    explicit QKafkaConsumer(QObject *parent = nullptr);

    void setBrokers(QString brokers);
    void setTopic(QString topic);

    int createConsumer();
    void run();

    void messageConsume(RdKafka::Message * message);

private:
    QString brokers;
    QString topic;

    std::string errStr;

    RdKafka::Conf * conf;
    RdKafka::Conf * tconf;

    RdKafka::Consumer * consumer = 0;

signals:
    void messageRecieved(QString message);

};

#endif // QKAFKACONSUMER_H
