2020-05-20 09:40:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-06-02 13:15:53 +00:00
|
|
|
#include <thread>
|
2020-05-20 09:40:49 +00:00
|
|
|
#include <memory>
|
2020-06-02 13:15:53 +00:00
|
|
|
#include <mutex>
|
2020-05-20 09:40:49 +00:00
|
|
|
#include <amqpcpp.h>
|
|
|
|
#include <amqpcpp/libevent.h>
|
|
|
|
#include <amqpcpp/linux_tcp.h>
|
|
|
|
#include <common/types.h>
|
|
|
|
#include <event2/event.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class RabbitMQHandler : public AMQP::LibEventHandler
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
RabbitMQHandler(event_base * evbase_, Poco::Logger * log_);
|
|
|
|
|
|
|
|
void onError(AMQP::TcpConnection * connection, const char * message) override;
|
2020-05-29 16:04:44 +00:00
|
|
|
void start(std::atomic<bool> & check_param);
|
2020-05-20 09:40:49 +00:00
|
|
|
void stop();
|
|
|
|
|
|
|
|
private:
|
|
|
|
event_base * evbase;
|
|
|
|
Poco::Logger * log;
|
2020-05-29 16:04:44 +00:00
|
|
|
|
|
|
|
std::mutex mutex;
|
2020-05-20 09:40:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|