ClickHouse/src/Storages/RabbitMQ/RabbitMQHandler.h

34 lines
618 B
C++
Raw Normal View History

#pragma once
2020-06-02 13:15:53 +00:00
#include <thread>
#include <memory>
2020-06-02 13:15:53 +00:00
#include <mutex>
#include <amqpcpp.h>
#include <amqpcpp/linux_tcp.h>
#include <common/types.h>
#include <amqpcpp/libuv.h>
namespace DB
{
class RabbitMQHandler : public AMQP::LibUvHandler
{
public:
2020-06-30 01:48:11 +00:00
RabbitMQHandler(uv_loop_t * loop_, Poco::Logger * log_);
void onError(AMQP::TcpConnection * connection, const char * message) override;
2020-06-29 15:41:17 +00:00
void stop() { stop_loop.store(true); }
void startLoop();
2020-07-02 16:44:04 +00:00
void iterateLoop();
private:
uv_loop_t * loop;
Poco::Logger * log;
2020-07-24 12:33:07 +00:00
std::atomic<bool> stop_loop = false;
2020-07-02 16:44:04 +00:00
std::mutex startup_mutex;
};
}