Rabbit MQ: creating queue, exchange and bindings from a command line

Rabbit Mq

Today we are going to discuss how to create queue, exchange and bind them together using command line instead of using client.

Please follow the steps for creating queue, exchange and binding from a command line -:

For creating Rabbit MQ exchange use the following command line -:

rabbitmqadmin -u {user} -p {password} -V {vhost} declare exchange name={name} type={type}

For example – You can create test.exchange with direct type as follows -:

rabbitmqadmin -u guest -p guest -V / declare exchange name=test.exchange type=direct

For creating Rabbit MQ queue use the following command line -:

rabbitmqadmin -u {user} -p {password} -V {vhost} declare queue name={name}

For example – You can create test.queue as follows -:

rabbitmqadmin -u guest -p guest -V / declare queue name=test.queue

For creating Rabbit MQ binding between exchange and queue use the following command line -:

rabbitmqadmin -u {user} -p {password} -V {vhost} declare binding source={Exchange} destination={queue}

For example – You can create binding between test.exchange and test.queue as follows -:

rabbitmqadmin -u guest -p guest -V / declare binding source=test.exchange destination=test.queue

That’s it, Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.

Scommerce

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.