rmqctl is the swiss-army knife tool for rabbitmq with kubectl like commands.
- binary release v1.0.15
- 'rmqctl publish' now publishes input from STDIN.
- 'rmqctl publish' -e flag now takes executable with arguments.
e.g -e "/usr/bin/ls -al"
- binary release v1.0.14
'rmqctl publish' adds new flag '-e' for user provided executable,
which generates messages to 'stdout' where rmqctl consumes and publishes to the queue.
- binary release v1.0.12
- fix issues for rabbit-hole.DeleteBinding uses BindingInfo.PropertiesKey as routing key
instead of BindingInfo.RoutingKey
- reference:
- https://github.com/michaelklishin/rabbit-hole/blob/master/bindings.go#L193 https://cdn.rawgit.com/rabbitmq/rabbitmq-management/v3.7.12/priv/www/api/index.html /api/bindings/vhost/e/exchange/q/queue/props
- binary release v1.0.11
- Logging bug fix
- binary release v1.0.10
- Purge queue / purge queue with prompt [y/n]
- Consume queue with numbers, e.g only consumes 10 messages
- binary release v1.0.9
- honors -a, -d in create queue/exchange
- binary release v1.0.8
- Now supports TLS connection for AMQP and HTTPS
- New 'tls' entry in rmqctl.conf
- New flag '-T' indicates using TLS connection.
- Bug fix.
- binary release v1.0.7
Now supports burst message publish mode.
Alone with daemon mode, rmqctl is used as a stress test tool for rabbitmq.
- e.g.
$ rmqctl publish exchange_name routing_key "MESSAGE" -b 1000000
- Publish with other payload
$ rmqctl publish exchange_name routing_key "$(cat payload.json)" -b 1000000
Now supports publish mode: Transient, Persistent
Change default config file name to rmqctl.conf
Change load config file name flag to '-c'
Formalize debug log message.
- binary release v1.0.3
- Publish/Consume use amqp protocol for performance. Other actions using rabbitmq REST API calls.
- Now supports bash/rawjson output format.
- binary release v1.0.0
- init. release
rmqctl loads rmqctl.conf (yaml) under working directory if there is one. Command arguments have higher precedence if provided.
username: guest
password: guest
port: 5672
apiport: 15672
host: localhost
tls: true
vhost: "/"
Loads rmqctl.conf from other location $ rmqctl -c path/to/rmqctl.conf COMMANDS
rmqctl uses amqp protocol library for publish/consume message for speed.
rmqctl supports burst publish/daemon consume, act as a perfect tool for stress test
and debugging the application.
Place client certificate and private key pair with read only permission (0400)
under $HOME/.ssh/ name as follows:
~/.ssh/rmq_cert.pem ~/.ssh/rmq_key.pem
If rabbitmq server using self-signed certificate,
remember to register self-signed CA into client's host system.
Setting up rabbitmq server TLS support for both
AMQP and API Service config file can refere to example:
- queue, queue in HA mode(with single command)
- exchange
- queue/exchange binding
- user
- vhost
- --help for more features
- queue
- exchange
- queue/exchange binding
- user
- vhost
- node
- policy
- --help for more features
- queue
- exchange
- queue/exchange binding
- user
- vhost
- policy
- --help for more features
- vhost
- user
- --help for more features
- Publish with routing key
- Publish messages generated from user provided executable
- Burst publishing (testing throughput)
- Supports transient|persistent modes
- --help for more features
- Consume supports ack|nack|reject|auto-ack acknowledge modes.
- Run as daemon, consume on-demand.
- Consume number of messages with flag -c NUMBER
- --help for more features
- Purge queue with prompt
- --help for more features
// TEST_QUEUE_1 created as durable $ rmqctl create queue TEST_QUEUE_1 -d done // TEST_QUEUE_2 created as durable and autodelete $ rmqctl -d create queue TEST_QUEUE_2 -d -a done
rmqctl is able to create queue in HA mode.
Three modes supported: all(default),exactly,nodes
Following command creates TEST_QUEUE_3 queue in HA mode,
which by default it has queue slaves in all other rabbitmq nodes (default: 'all' mode)
rmqctl automatically creates queue's HA policy with name: QueueName_HA
$ rmqctl create queue TEST_QUEUE_3 --HA done
$ rmqctl list queue |Name |Vhost |Durable |AutoDelete |MasterNode |Status |Consumers |Policy |Messages |TEST_QUEUE_1 |/ |true |false |rabbit@r1 | |0 | |0 |TEST_QUEUE_2 |/ |true |true |rabbit@r1 | |0 | |0 |TEST_QUEUE_3 |/ |true |true |rabbit@r1 | |0 |TEST_QUEUE_3_HA |0
$ rmqctl list policy Name |Vhost |Pattern |Priority |ApplyTo |Definition |TEST_QUEUE_3_HA |/ |TEST_QUEUE_3 |0 |queues |map[ha-mode:all ha-sync-mode:automatic]
$ rmqctl list queue TEST_QUEUE_1 -o json
[
{
"name": "TEST_QUEUE_1",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {},
"node": "rabbit@r1",
"status": "",
"memory": 10576,
...
}
]
$ rmqctl create exchange TEST_EXCHANGE_1 -d -t fanout done
$ rmqctl list exchange |Name |Vhost |Type |Durable |AutoDelete | |/ |direct |true |false |TEST_EXCHANGE_1 |/ |fanout |true |false |amq.direct |/ |direct |true |false |amq.fanout |/ |fanout |true |false |amq.headers |/ |headers |true |false |amq.match |/ |headers |true |false |amq.rabbitmq.trace |/ |topic |true |false |amq.topic |/ |topic |true |false
$ rmqctl list exchange TEST_EXCHANGE_1 -o json
{
"name": "TEST_EXCHANGE_1",
"vhost": "/",
"type": "fanout",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {},
"incoming": [],
"outgoing": []
}
rmqctl is able to create exchange bindings as well.
$ rmqctl create bind TEST_EXCHANGE_1 TEST_QUEUE_1 ROUTING_KEY done $ rmqctl create bind TEST_EXCHANGE_1 TEST_QUEUE_2 ROUTING_KEY done Creates exchange binding $ rmqctl create bind TEST_EXCHANGE_1 TEST_EXCHANGE_2 ROUTING_KEY -t exchange done
$ rmqctl list bind |Source |Destination |Vhost |Key |DestinationType | |TEST_QUEUE_1 |/ |TEST_QUEUE_1 |queue | |TEST_QUEUE_2 |/ |TEST_QUEUE_2 |queue |TEST_EXCHANGE_1 |TEST_QUEUE_1 |/ |RUN |queue |TEST_EXCHANGE_1 |TEST_EXCHANGE_2 |/ |RUN |exchange
Publish to a fanout exchange, observing queues bounded to the
exchange TEST_EXCHANGE_1 received the message.
$ rmqctl publish TEST_EXCHANGE_1 RUN "This is a test message" done $ rmqctl list queue |Name |Vhost |Durable |AutoDelete |MasterNode |Status |Consumers |Policy |Messages |TEST_QUEUE_1 |/ |true |false |rabbit@r1 | |0 | |1 |TEST_QUEUE_2 |/ |true |true |rabbit@r1 | |0 | |1 |TEST_QUEUE_3 |/ |true |true |rabbit@r1 | |0 |TEST_QUEUE_3_HA |0
Publish to a fanout exchange in burst mode,
observing queues bounded to the exchange TEST_EXCHANGE_1 received the message.
$ rmqctl publish TEST_EXCHANGE_1 RUN "This is a test message" -b 424242 done $ rmqctl list queue |Name |Vhost |Durable |AutoDelete |MasterNode |Status |Consumers |Policy |Messages |TEST_QUEUE_1 |/ |true |false |rabbit@r1 | |0 | |424243 |TEST_QUEUE_2 |/ |true |true |rabbit@r1 | |0 | |424243 |TEST_QUEUE_3 |/ |true |true |rabbit@r1 | |0 |TEST_QUEUE_3_HA |0
Publish messages generated from user provided executable to the queue.
$ rmqctl publish TEST_EXCHANGE_1 RUN -e "/usr/bin/ls -al" done $ rmqctl consume TEST_QUEUE_1 |Message drwxr-xr-x 1 vs users 1566 Mar 16 13:07 Desktop drwxr-xr-x 1 vs users 0 Feb 11 21:25 Documents drwxr-xr-x 1 vs users 616 Mar 17 15:34 Downloads drwxr-xr-x 1 vs users 322 Feb 13 08:40 .fzf
Publish messages read from STDIN.
$ rmqctl publish TEST_EXCHANGE_1 RUN hello, rabbitmq! greetings, rabbitmq! done $ rmqctl consume TEST_QUEUE_1 |Message hello, rabbitmq! greetings, rabbitmq! $ rmqctl publish TEST_EXCHANGE_1 RUN <<< "hi, there!" done $ rmqctl consume TEST_QUEUE_1 |Message hi, there! equivalent to $ rmqctl publish TEST_EXCHANGE_1 RUN -e "/usr/bin/ls -al" $ ls -al | rmqctl publish TEST_EXCHANGE_1 RUN done $ rmqctl consume TEST_QUEUE_1 |Message drwxr-xr-x 1 vs users 1566 Mar 16 13:07 Desktop drwxr-xr-x 1 vs users 0 Feb 11 21:25 Documents drwxr-xr-x 1 vs users 616 Mar 17 15:34 Downloads drwxr-xr-x 1 vs users 322 Feb 13 08:40 .fzf
Consume 3 messages.
$ rmqctl consume TEST_QUEUE_1 -c 3 |Message This is a test message This is a test message This is a test message
$ rmqctl consume TEST_QUEUE_2 -d |Message This is a test message This is a test message ...
Purge queue without prompt.
$ rmqctl purge TEST_QUEUE_1 -f done
--help for more details.
$ rmqctl --help
Bug, feature requests, welcome to shoot me an email at:
vsdmars<<at>>gmail.com