bunnish

‘bunnish’ is a command for AMQP access to message queue.

Supported Ruby versions and implementations

bunnish should work identically on:

  • Ruby 1.9.3+

  • Ruby 1.9.2+

  • Ruby 1.8.7+

Install

You can install bunnish by gem.

gem install bunnish

Usage

Publish messages:

$ cat messages.txt
foo
bar
baz
$ cat messages.txt | bunnish publish -h mq-server -p 5672 test-queue --verbose
[2012-12-08 20:33:33](INFO) create direct exchange 'test-queue'
[2012-12-08 20:33:33](INFO) create queue 'test-queue'
[2012-12-08 20:33:33](INFO) bind queue 'test-queue' to direct exchange 'test-queue'
[2012-12-08 20:33:33](INFO) publish to test-queue(0 messages, 0 consumers)
[2012-12-08 20:33:33](INFO) published 3 messages into test-queue(3 messages, 0 consumers)

Publish messages to multiple queues:

$ cat messages.txt | bunnish publish -h mq-server -p 5672 test-queue-1,test-queue-2 --verbose
[2012-12-09 21:10:21](INFO) create direct exchange 'test-queue-1'
[2012-12-09 21:10:21](INFO) create queue 'test-queue-1'
[2012-12-09 21:10:21](INFO) bind queue 'test-queue-1' to direct exchange 'test-queue-1'
[2012-12-09 21:10:21](INFO) create direct exchange 'test-queue-2'
[2012-12-09 21:10:21](INFO) create queue 'test-queue-2'
[2012-12-09 21:10:21](INFO) bind queue 'test-queue-2' to direct exchange 'test-queue-2'
[2012-12-09 21:10:21](INFO) publish to test-queue-1(0 messages, 0 consumers)
[2012-12-09 21:10:21](INFO) publish to test-queue-2(0 messages, 0 consumers)
[2012-12-09 21:10:21](INFO) published 3 messages into test-queue-1(3 messages, 0 consumers)
[2012-12-09 21:10:21](INFO) published 3 messages into test-queue-2(3 messages, 0 consumers)

Check queue status:

$ bunnish status -h mq-server -p 5672 test-queue --verbose
test-queue : 3 messages, 0 consumers

Check multiple queue status:

$ bunnish status -h mq-server -p 5672 test-queue-1,test-queue-2 --verbose
test-queue-1 : 3 messages, 0 consumers
test-queue-2 : 3 messages, 0 consumers

Get queue count:

$ bunnish count -h mq-server -p 5672 test-queue
3

Subscribe from queue:

$ bunnish subscribe -h mq-server -p 5672 test-queue --verbose
[2012-12-08 20:35:57](INFO) subscribe from test-queue(3 messages, 0 consumers)
foo
bar
baz
[2012-12-08 20:35:58](INFO) subscribed 3 messages from test-queue(0 messages, 0 consumers)
$ bunnish status -h mq-server -p 5672 test-queue
1 queue is empty:
  test-queue

Subscribe only 1 message:

$ bunnish subscribe -h mq-server -p 5672 test-queue --message-max 1 --verbose
[2012-12-08 20:35:57](INFO) subscribe from test-queue(3 messages, 0 consumers)
foo

Delete queue:

$ bunnish delete -h mq-server -p 5672 test-queue --verbose
[2012-12-09 21:13:10](INFO) deleted test-queue

Delete multiple queues:

$ bunnish delete -h mq-server -p 5672 test-queue-1,test-queue-2 --verbose
[2012-12-09 21:12:34](INFO) deleted test-queue-1
[2012-12-09 21:12:34](INFO) deleted test-queue-2

Read help:

$ bunnish help

Contributing to bunnish

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2012 Kenji Hara. See LICENSE.txt for further details.