diff options
author | Emile Joubert <emile@lshift.net> | 2008-11-16 12:24:53 +0000 |
---|---|---|
committer | Emile Joubert <emile@lshift.net> | 2008-11-16 12:24:53 +0000 |
commit | c5c1bd721935c6bda4189cc2bcd100817c3c2eee (patch) | |
tree | 407cda6d6029da098a454c579cf8d55718f43bb0 | |
parent | 1c56cc3f24287f62124f8e3c74a66be5b547fca1 (diff) | |
download | rabbitmq-server-c5c1bd721935c6bda4189cc2bcd100817c3c2eee.tar.gz |
Added rabbitmqctl interface for listing exchanges
-rw-r--r-- | src/rabbit_control.erl | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index d6f5ad73..c9fa6ddf 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -89,7 +89,9 @@ Available commands: list_user_vhosts <UserName> list_vhost_users <VHostPath> - list_queues <InfoItem> [<InfoItem> ...] + list_queues <QueueInfoItem> [<QueueInfoItem> ...] + list_exchanges <ExchangeInfoItem> [<ExchangeInfoItem> ...] + list_bindings <node> should be the name of the master node of the RabbitMQ cluster. It defaults to the node named \"rabbit\" on the local host. On a host named @@ -97,9 +99,12 @@ defaults to the node named \"rabbit\" on the local host. On a host named NODENAME has been set to some non-default value at broker startup time). The output of hostname -s is usually the correct suffix to use after the \"@\" sign. -<InfoItem> must be a member of the list [name, durable, auto_delete, arguments, -pid, messages_ready, messages_unacknowledged, messages_uncommitted, messages, -acks_uncommitted, consumers, transactions, memory]. +<QueueInfoItem> must be a member of the list [name, durable, auto_delete, +arguments, pid, messages_ready, messages_unacknowledged, messages_uncommitted, +messages, acks_uncommitted, consumers, transactions, memory]. + +<ExchangeInfoItem> must be a member of the list [name, type, durable, +auto_delete, arguments]. "), halt(1). @@ -189,12 +194,24 @@ action(list_vhost_users, Node, Args = [_VHostPath]) -> action(list_queues, Node, Args) -> io:format("Listing queues ...~n"), + display_info_list(rpc_call(Node, rabbit_amqqueue, info_all, [[list_to_atom(X) || X <- Args]])); + +action(list_exchanges, Node, Args) -> + io:format("Listing exchanges ...~n"), + display_info_list(rpc_call(Node, rabbit_exchange, info_all, [[list_to_atom(X) || X <- Args]])); + +action(list_bindings, _, []) -> + io:format("Listing bindings ...~n"), + io:format("Not implemented~n"), + ok. + +display_info_list(L) -> lists:map( fun (ResultRow) -> lists:map( fun(ResultColumn) -> case ResultColumn of - {name, #resource{virtual_host = VHostPath, kind = queue, name = Name}} -> + {name, #resource{virtual_host = VHostPath, name = Name}} -> io:format("~s@~s ", [Name, VHostPath]); {_, Res} -> io:format("~w ", [Res]) @@ -203,7 +220,7 @@ action(list_queues, Node, Args) -> ResultRow), io:nl() end, - rpc_call(Node, rabbit_amqqueue, info_all, [[list_to_atom(X) || X <- Args]])), + L), ok. display_list(L) when is_list(L) -> |