Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api usage for predefined Queue and Exchange #57

Open
abhishek22j06 opened this issue Jan 5, 2017 · 1 comment
Open

Api usage for predefined Queue and Exchange #57

abhishek22j06 opened this issue Jan 5, 2017 · 1 comment

Comments

@abhishek22j06
Copy link

Hi,

In rabbitmq server i have predefined Exchange and Queue. Do we need to call createExchange() and createQueue() to get exchange and queue pointers? Currently i am using createExchange() and createQueue() for the predefined exchange and queues. Does it overwrite the existing exchange and queue? If my usage is wrong then what is correct way of getting exchange and queue pointer for predefined exchange and queues.[Please note as per requirement queues are durable.]

@abhishek22j06
Copy link
Author

abhishek22j06 commented Jan 5, 2017

Please find the test code snippet:
try
{
cout<<"Conn_Info:"<<connInfo<<endl;
//connInfo = ":@:5672/";
m_pamqp=new AMQP(connInfo,30); //AMQP modified to give timeout
m_prodexchange=m_pamqp->createExchange(m_exchangeName); //Exchange is predefined and durable
m_prodexchange->Declare(m_exchangeName, "direct",AMQP_DURABLE);

    AMQPQueue * queue = m_pamqp->createQueue("TestMT1");  //TestMT1 is predefined durable queue
    queue->Bind( m_exchangeName, m_routekey);
    cout<<"m_prodexchange:"<<m_prodexchange<<endl;
    /*Code to create queue with routing key[start]*/
    /*Code to create queue with routing key[end]*/
    initializeExHeader(RMQExHeader);
    cout<<"RMQMessageProducer::publishMsg Sendng message:"<<message.c_str()
        <<" with Routing key:"<<m_routekey.c_str()<<endl;
   m_prodexchange->Publish(message ,m_routekey);

}catch(AMQPException e){
    cout<<"Exception reply code:"<<e.getMessage()<<endl;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant