[rabbitmq-discuss] How to publish message

tuan225 tuannn225 at gmail.com
Thu Feb 13 10:17:36 GMT 2014

Hi everybody, I have just study RabbitMQ with SimpleAmqpClient, but when I
published message using follow code:

    #include <SimpleAmqpClient/SimpleAmqpClient.h>

    #include <iostream>
    #include <stdlib.h>

    using namespace AmqpClient;
    int main()
        char *szBroker = getenv("AMQP_BROKER");
        Channel::ptr_t channel;
        if (szBroker != NULL)
            channel = Channel::Create(szBroker);
            channel = Channel::Create("", 5672, "guest", "guest",
"/", 4096);

        channel->BindQueue("alanqueue", "amq.direct", "alankey");

        BasicMessage::ptr_t msg_in = BasicMessage::Create();

        msg_in->Body("Body massegae.");

        channel->BasicPublish("amq.direct", "alankey", msg_in);

        channel->BasicConsume("alanqueue", "consumertag");

        BasicMessage::ptr_t msg_out =

        std::cout << "Message text: " << msg_out->Body() << std::endl;
        return 0;

I don't see message in alanqueue queue. What wrong in here?

(Sorry about my English)


View this message in context: http://rabbitmq.1065348.n5.nabble.com/How-to-publish-message-tp33320.html
Sent from the RabbitMQ mailing list archive at Nabble.com.

More information about the rabbitmq-discuss mailing list