В следующем демоне поток-получатель не получает сообщения, отправленные из потока-отправителя через Rabbit MQ. ⇐ C++
-
Anonymous
В следующем демоне поток-получатель не получает сообщения, отправленные из потока-отправителя через Rabbit MQ.
#include #include #include #include #include // Включаем этот заголовок для std::ref const std::string QUEUE_NAME = "hello_queue"; const std::string EXCHANGE_NAME = "hello_exchange"; const std::string ROUTING_KEY = "hello_routing_key"; std::string bytesToString(const amqp_bytes_t& bytes) { return std::string(static_cast(bytes.bytes), bytes.len); } std::string getQueueId(amqp_connection_state_t conn, const std::string&queueName) { amqp_queue_declare(conn, 1, amqp_cstring_bytes(queueName.c_str()), 0, 0, 0, 1, amqp_empty_table); amqp_rpc_reply_t ответ = amqp_get_rpc_reply (conn); если (reply.reply_type == AMQP_RESPONSE_NORMAL) { amqp_queue_declare_ok_t* Declare_ok = reinterpret_cast(reply.reply.decoded); вернуть bytesToString (declare_ok-> очередь); } еще { std::cerr
#include #include #include #include #include // Включаем этот заголовок для std::ref const std::string QUEUE_NAME = "hello_queue"; const std::string EXCHANGE_NAME = "hello_exchange"; const std::string ROUTING_KEY = "hello_routing_key"; std::string bytesToString(const amqp_bytes_t& bytes) { return std::string(static_cast(bytes.bytes), bytes.len); } std::string getQueueId(amqp_connection_state_t conn, const std::string&queueName) { amqp_queue_declare(conn, 1, amqp_cstring_bytes(queueName.c_str()), 0, 0, 0, 1, amqp_empty_table); amqp_rpc_reply_t ответ = amqp_get_rpc_reply (conn); если (reply.reply_type == AMQP_RESPONSE_NORMAL) { amqp_queue_declare_ok_t* Declare_ok = reinterpret_cast(reply.reply.decoded); вернуть bytesToString (declare_ok-> очередь); } еще { std::cerr
Мобильная версия