2020-05-20 09:40:49 +00:00
|
|
|
#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)
|
2020-05-20 09:40:49 +00:00
|
|
|
{
|
|
|
|
LOG_ERROR(log, "Library error report: " << message);
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-26 17:34:57 +00:00
|
|
|
void RabbitMQHandler::start()
|
2020-05-20 09:40:49 +00:00
|
|
|
{
|
|
|
|
event_base_loop(evbase, EVLOOP_NONBLOCK);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RabbitMQHandler::stop()
|
|
|
|
{
|
|
|
|
event_base_loopbreak(evbase);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|