Home

bkjones edited this page Sep 13, 2010 · 4 revisions
Clone this wiki locally

Bunny is a command line utility for interacting with and getting information from a RabbitMQ AMQP broker. It’s written in Python and is tested on Linux and Mac OS X. If it works in Windows, please let me know!

Bunny is useful as a helper utility in testing and debugging applications that make heavy use of AMQP. It turns out that, while Alice is a pretty nice dashboard, it’s not very interactive. I needed the ability to purge a queue of all of my test messages, create queues, exchanges and bindings quickly without writing a bunch of code, and do simple message sending and dumping messages off the queue to verify their contents and such.

It supports readline (command history), and does a decent job of trying to help you along by prompting you with help if you mistype a command. There’s also a ‘help ’ built in, and typing ‘?’ will give you a list of commands.

Here’s an example Bunny session (with a little extra debugging output) which should get you familiar with the basics pretty quickly (press ctrl-D to exit Bunny):


Brian-Joness-iMac:bunny bjones$ ./bunny.py 
--> ?

Documented commands (type help <topic>):
========================================
create_binding   create_queue     delete_queue  get_status   send_message
create_exchange  delete_exchange  dump_message  purge_queue

Undocumented commands:
======================
EOF  connect  exit  help  qlist

--> connect 
Host: rd2
Username: guest
Password: 
Trying connect to rd2:/ as guest
Success!
rd2./: qlist


Exchange: /


rd2./: create_exchange bunnytest
dictionary update sequence element #0 has length 1; 2 is required
Invalid input. Here's some help: 
	create_exchange name=<name> [type=<type>]
	Create an exchange with given name. Type is 'direct' by default.
rd2./: create_exchange bunnytest name=bunnytest 
dictionary update sequence element #0 has length 1; 2 is required
Invalid input. Here's some help: 
	create_exchange name=<name> [type=<type>]
	Create an exchange with given name. Type is 'direct' by default.
rd2./: create_exchange name=bunnytest
No type - using 'direct'
rd2./: qlist


Exchange: bunnytest
Exchange: /


rd2./: create_queue
You need provide a name for the queue
rd2./: create_queue bunnytestQ
rd2./: create_binding
Invalid input. Here's some help: 
	create_binding exchange=<exch> queue=<queue>
	Binds given queue to named exchange
Error was:  'queue'
rd2./: create_binding exchange=bunnytest queue=bunnytestQ
rd2./: qlist


Exchange: bunnytest
	bunnytestQ
Exchange: /


rd2./: send_message
need more than 1 value to unpack
	send_message <exchange>:<msg>
	Sends message to the given exchange.
rd2./: send_message bunnytest:"Here's my message!"
rd2./: dump_message
"Here's my message!"
rd2./: dump_message
No messages in that queue
rd2./: help dump_message
	dump_message <queue>
	Pops a message off the queue and dumps the body to output.
rd2./: help get_status
	get_status <queue>
	Reports number of messages and consumers for a queue
rd2./: get_status bunnytestQ
bunnytestQ: 0 messages, 0 consumers
rd2./: send_message bunnytest:"Test message"
rd2./: get_status bunnytestQ
bunnytestQ: 1 messages, 0 consumers
rd2./: