RabbitMQ creating queues and bindings from command line

后端 未结 11 1611
时光取名叫无心
时光取名叫无心 2020-12-12 15:25

If I have RabbitMQ installed on my machine, is there a way to create a message queue from the command line and bind it to a certain exchange without using a client?

I

11条回答
  •  被撕碎了的回忆
    2020-12-12 16:05

    Create RabbitMq Exchange, Queue and Bindings dynamically from CLI on Windows

    I already had a RabbitMQ Server installed and running with multiple queue and exchange and now wanted to create it on the fly from command line. I know it is an old question but I thought giving out this information will be helpful.

    Following is what I did:

    Setup

    1. Downloaded and installed Python 2.6.6-201008-24 Windows x86-64 MSI installer , any version of python greater than 2.X but not 3.X
    2. Download RabbitMqAdmin: RabbitMq Web User Interface has a link Command Line which navigates to http://server-name:15672/cli/ (server-name: server on which rabbitmq is installed) alternatively,use the above url and save the file as rabbitmqadmin.exe in the python exe location

    eg: C:\Python26\ C:\Python26\python C:\Python26\rabbitmqadmin.exe

    Code:in a batch file used the below commands

    1. Create exchange:

      c:\python26\python.exe rabbitmqadmin.exe declare exchange name=ExchangeName1 type=topic durable=true

    2. Create queue:

      c:\python26\python.exe rabbitmqadmin.exe declare queue name=NameofQueue1 durable=true

    3. Create binding:

      c:\python26\python.exe rabbitmqadmin.exe declare binding source=ExchangeName1 destination_type=queue destination=NameofQueue1 routing_key=RoutingKey1

    by executing rabbitmqadmin.exe -help -subcommands it lists all the available commands

    eg: c:\python26\python.exe rabbitmqadmin.exe -help -subcommands

提交回复
热议问题