开发者

Is there an API for listing queues and exchanges on RabbitMQ?

I've loo开发者_StackOverflow中文版ked quite a bit, but I haven't been able to find a good programmatic way to list the queues on a RabbitMQ server.

This is important because I need to clean up my queues and exchanges when I'm done with them. I don't always have a good "done" event that can be used to trigger a cleanup, so I'd like to do it with more of a garbage collection model. If I can list the queues, I can verify that the objects that they're related to shouldn't be producing more entries and clean them up.

I know I can use rabbitmqctl to do it, but that needs elevated privileges.

Since I haven't been able to find a way to list the queues programmatically, I've been keeping a list of names in the database. That works, but it's ugly.


You could use Alice - http://github.com/auser/alice. It is a REST interface to execute rabbitmqctl commands


2012 update

The RabbitMQ development has probably made the question and other answers out-of-date. Management Plugin that provides REST API is now a part of RabbitMQ. The plugin might be disabled by default, thought.


If what you need is to auto delete the exchange and the queues when you are done, then you can accomplish that based on the options that you use for exchange_declare and queue_declare.

Coming back to your question of listing queues and exchanges, you can use a tool like this one: http://github.com/tnc/rac

With a little tweaking you can write a PHP script to get what you need. Just check under the lib folder of that project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜