Joe Miller bio photo

Joe Miller

Ops/Engineering. Continuous DevOping at Webscale

Twitter Github

If you have read @ripienaar’s excellent series of articles on common messaging patterns you probably noticed a handy CLI tool for working with STOMP queues called stompcat. I looked around for something similar for AMQP brokers but couldn’t find anything quite the same. There is amqp-utils but I had some issues with these and the tools didn’t work quite like I was hoping. So I wrote amqpcat with the idea of providing a similar tool to stompcat.

Available on github and rubygems.org: https://github.com/joemiller/amqpcat

Installation is easy:

sudo gem install amqpcat --no-rdoc --no-ri

1:1 Messaging demonstration

Publish a message:

$ echo "hello there" | amqpcat amqp://guest:guest@rabbitmq -t direct -n test.direct --publisher

Receive the message:

$ amqpcat amqp://guest:guest@rabbitmq -t direct -n test.direct --consumer
hello there

Pretty simple. There are various other options, run with -h to see them all. You can easily load-balance amongst multiple consumers by starting multiple consumers with the same url and options. See the test_direct.sh example for a demo of this.

1:N / PubSub Messaging

Start 2 (or more) consumers:

$ amqpcat amqp://rabbitmq -t fanout -n test.fanout -s "Consumer-1: " --consumer &
$ amqpcat amqp://rabbitmq -t fanout -n test.fanout -s "Consumer-2: " --consumer &

Publish a message:

$ echo "hello there" | amqpcat amqp://guest:guest@rabbitmq -t fanout -n test.fanout --publisher

You should see both consumers receive the message, ie:

Consumer-1: hello there
Consumer-2: hello there

See test_fanout.sh for a similar example.

SSL support

SSL support (server verification, and client certs) has been written into the tool but I have not been able to test it to a working state yet.