34 lines
844 B
C++
34 lines
844 B
C++
#include "src/rmq/ConnectionHandler.hpp"
|
|
#include <iostream>
|
|
#include <amqpcpp.h>
|
|
#include <uv.h>
|
|
|
|
int main()
|
|
{
|
|
// access to the event loop
|
|
auto *loop = uv_default_loop();
|
|
|
|
// handler for libev
|
|
ConnectionHandler handler(loop);
|
|
|
|
// make a connection
|
|
|
|
AMQP::TcpConnection connection(&handler, AMQP::Address("amqps://proxmox:proxmox@mq.pseudot.org:5671/"));
|
|
|
|
// we need a channel too
|
|
AMQP::TcpChannel channel(&connection);
|
|
|
|
// create a temporary queue
|
|
channel.declareQueue("ciao-bella-cpp",AMQP::durable).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;
|
|
});
|
|
|
|
// run the loop
|
|
uv_run(loop, UV_RUN_DEFAULT);
|
|
|
|
// done
|
|
return 0;
|
|
}
|