I'm working with C++ and rabbitmq and I'm having trouble handling errors when consuming messages. Here is the relevant part of my code:
amqp_rpc_reply_t reply = amqp_consume_message(connection_->getConnection(), &envelope, NULL, 0);
if (reply.reply_type != AMQP_RESPONSE_NORMAL) {
std::cerr << "Error receiving message: " << amqp_error_string2(reply.reply_type) << std::endl;
if (reply.library_error) {
std::cerr << "Library error: " << amqp_error_string(reply.library_error) << std::endl;
// what to do?
}
}
When I run this code, I sometimes encounter library errors, but I'm not sure how to properly handle them. Should I throw an exception, close the connection and attempt a reconnect, or is there another recommended approach?
Any insights or examples would be greatly appreciated.
Thanks in advance!
I'm working with C++ and rabbitmq and I'm having trouble handling errors when consuming messages. Here is the relevant part of my code:
When I run this code, I sometimes encounter library errors, but I'm not sure how to properly handle them. Should I throw an exception, close the connection and attempt a reconnect, or is there another recommended approach?
Any insights or examples would be greatly appreciated.
Thanks in advance!