/** * LibEV.cpp * * Test program to check AMQP functionality based on LibEV * * @author Emiel Bruijntjes * @copyright 2015 - 2016 Copernica BV */ /** * Dependencies */ #include #include #include /** * Main program * @return int */ int main() { // access to the event loop auto *loop = EV_DEFAULT; // handler for libev AMQP::LibEvHandler handler(loop); // make a connection AMQP::TcpConnection connection(&handler, AMQP::Address("amqp://guest:guest@localhost/")); // we need a channel too AMQP::TcpChannel channel(&connection); // create a temporary queue channel.declareQueue(AMQP::exclusive).onSuccess([&connection](const std::string &name, uint32_t messagecount, uint32_t consumercount) { // report the name of the temporary queue std::cout << "declared queue " << name << std::endl; // now we can close the connection connection.close(); }); // run the loop ev_run(loop, 0); // done return 0; }