AMQP-CPP - RPC client

91 views
Skip to first unread message

U MK

unread,
Feb 19, 2020, 6:32:27 AM2/19/20
to rabbitmq-c-users
Hi,

I am using copernica AMQP-CPP library.

I am using sample AMQP CPP rpc client application.

Every time while publishing data , calling PublishMsg("Message ");
Till declareQueue call back registration passed data is fine, after callback trigger szMsg is corrupted.

code snippet
void PublishMsg( const char* szMsg)
{
AMQP::QueueCallback callback = [&szMsg](const std::string& name,
int msgcount,
int consumercount)
{
if(bStop)
{
const std::string correlation(uuid());
char szFib[MAX_PATH] = { 0 }, szMsg[MAX_PATH] = { 0 };
sprintf_s(szFib, _countof(szFib), "%s", szMsg);

AMQP::Envelope env(szFib);
env.setCorrelationID(correlation);
env.setReplyTo(name);

channel->publish("ex", "rpc.queue", env);

std::cout << " [x] Requesting fib: " << szFib << std::endl;
}
//Sleep(10);
};
channel->declareQueue("amq.rabbitmq.reply-to", AMQP::exclusive).onSuccess(callback);
}

Can someone suggest me where I am missing?

Thanks,
Mohan
Reply all
Reply to author
Forward
0 new messages