You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libboostasio.cpp: In function ‘int main()’:
libboostasio.cpp:56:11: error: ‘Reliable’ is not a member of ‘AMQP’
56 | AMQP::Reliable reliable(&channel);
| ^~~~~~~~
libboostasio.cpp:58:5: error: ‘reliable’ was not declared in this scope
58 | reliable.publish("", QNAME, "my first message")
Sample code
I am using the libboostasio.cpp example.
#include<boost/asio/io_service.hpp>
#include<boost/asio/strand.hpp>
#include<boost/asio/deadline_timer.hpp>
#include<amqpcpp.h>
#include<amqpcpp/libboostasio.h>
#include<iostream>
#defineQNAME"test-Q"/** * Main program * @return int*/intmain()
{
// access to the boost asio handler// note: we suggest use of 2 threads - normally one is fin (we are simply demonstrating thread safety).
boost::asio::io_service service(4);
// handler for libev
AMQP::LibBoostAsioHandler handler(service);
// make a connection
AMQP::TcpConnection connection(&handler, AMQP::Address("amqp://test:nopass@localhost/"));
// we need a channel too
AMQP::TcpChannel channel(&connection);
// create a temporary queue
channel
.declareQueue(QNAME)
.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();
});
AMQP::Reliable reliable(channel);
// publish a message via the reliable-channel
reliable.publish("", QNAME, "my first message")
.onAck([]() {
// the message has been acknowledged by RabbitMQ (in your application// code you can now safely discard the message as it has been picked up)
std::cout << "onSuccess: " << std::endl;
}).onNack([]() {
// the message has _explicitly_ been nack'ed by RabbitMQ (in your application// code you probably want to log or handle this to avoid data-loss)
std::cout << "onNack: " << std::endl;
}).onLost([]() {
// because the implementation for onNack() and onError() will be the same// in many applications, you can also choose to install a onLost() handler,// which is called when the message has either been nack'ed, or lost.
std::cout << "onLost: " << std::endl;
}).onError([](constchar *message) {
// a channel-error occurred before any ack or nack was received, and the // message is probably lost (which you might want to handle)
std::cout << "onError: " << message << std::endl;
});
// run the handler// a t the moment, one will need SIGINT to stop. In time, should add signal handling through boost API.return service.run();
}
The text was updated successfully, but these errors were encountered:
Describe the bug
I am trying to compile using the Reliable. But it is giving me compilation error. I am using
4.3.19
version on Ubuntu 22.Expected behavior and actual behavior
A successful compilation. I have built the library with,
It is giving me the following error:
Sample code
I am using the libboostasio.cpp example.
The text was updated successfully, but these errors were encountered: