std::string SimpleRpcClient::Call(const std::string &message)
{
    BasicMessage::ptr_t outgoing_msg = BasicMessage::Create();
    outgoing_msg->Body(message);

    BasicMessage::ptr_t reply = Call(outgoing_msg);
    return reply->Body();
}
Example #2
0
TEST_F(connected_test, get_ok)
{
  BasicMessage::ptr_t message = BasicMessage::Create("Message Body");
  std::string queue = channel->DeclareQueue("");
  channel->BasicPublish("", queue, message, true);

  Envelope::ptr_t new_message;
  EXPECT_TRUE(channel->BasicGet(new_message, queue));
  EXPECT_EQ(message->Body(), new_message->Message()->Body());
}
Example #3
0
TEST(test_get, get_big)
{
  // Smallest frame size allowed by AMQP
  Channel::ptr_t channel = Channel::Create(connected_test::GetBrokerHost(), 5672, "guest", "guest", "/", 4096);
  // Create a message with a body larger than a single frame
  BasicMessage::ptr_t message = BasicMessage::Create(std::string(4099, 'a'));
  std::string queue = channel->DeclareQueue("");

  channel->BasicPublish("", queue, message);
  Envelope::ptr_t new_message;
  EXPECT_TRUE(channel->BasicGet(new_message, queue));
  EXPECT_EQ(message->Body(), new_message->Message()->Body());
}
std::string SimpleSubscriber::WaitForMessageString()
{
	BasicMessage::ptr_t incoming = WaitForMessage();
	return incoming->Body();
}