amqpcat - Netcat-like tool for AMQP queues

This was originally written as a “toy” to learn and experiment with rabbitmq. It allows you to easily read/write from AMQP queues/exchanges from the command line or from shell scripts. It is implemented with the bunny Ruby gem.


Install from gem:

sudo gem install amqpcat

Install from github:

git clone
gem build amqpcat.gemspec
gem install amqpcat-0.0.1.gem

Example Usage

1:1 Messaging

Start a consumer. This will block until a message is received.

amqpcat --consumer amqp://guest:[email protected]/

Publish a message:

echo "hello rabbit" | amqpcat --publisher amqp://guest:[email protected]/

The consumer should output the message and exit.

1:N (fanout / pubsub)

See the examples/ script for another example of fanout messaging.

Start 2 consumers, using -s to prefix the output of each with an identifying string:

amqpcat --consumer -n fanout.test -t fanout -s "Consumer 1: " amqp://guest:[email protected]/
amqpcat --consumer -n fanout.test -t fanout -s "Consumer 2: " amqp://guest:[email protected]/

Note: In fanout mode, consumers will create their own server-named queues and bind to an exchange defined by the -n parameter.

Published a message to the exchange:

echo "hello rabbits" | amqpcat --publisher -n fanout.test -t fanout amqp://guest:[email protected]/

Both of the consumers should print out the message we published.


Run amqpcat -h to get detailed help output.

One-message -vs- Continuous message mode

By default, when publishing, amqpcat will use the newline character to distinguish between messages to publish. However, you can send a single message by using the --once option. This can be useful if you need to send a single message that contains new lines.

SSL Support

SSL support has been written but is not tested nor is it fully working at this time (v0.0.1).

Additionally, the –ssl-key and –ssl-cert options are only supported under newer versions of the Bunny gem (0.8+) or if bunny is installed from the master branch on github.


  1. Fork it.
  2. Create a branch (git checkout -b my_feature)
  3. Commit your changes (git commit -am "did some stuff")
  4. Push to the branch (git push origin my_feature)
  5. Create an with a link to your branch


Joe Miller -


Author:: Joe Miller (<[email protected]>)
Copyright:: Copyright (c) 2012 Joe Miller
License:: Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.