ClickHouse/src/Storages/RabbitMQ/RabbitMQHandler.cpp

33 lines
551 B
C++
Raw Normal View History

#include <common/logger_useful.h>
#include <Storages/RabbitMQ/RabbitMQHandler.h>
namespace DB
{
RabbitMQHandler::RabbitMQHandler(event_base * evbase_, Poco::Logger * log_) :
LibEventHandler(evbase_),
evbase(evbase_),
log(log_)
{
}
2020-05-26 17:34:57 +00:00
void RabbitMQHandler::onError(AMQP::TcpConnection * , const char * message)
{
LOG_ERROR(log, "Library error report: " << message);
stop();
}
2020-05-26 17:34:57 +00:00
void RabbitMQHandler::start()
{
event_base_loop(evbase, EVLOOP_NONBLOCK);
}
void RabbitMQHandler::stop()
{
event_base_loopbreak(evbase);
}
}