diff options
| -rw-r--r-- | docs/rabbitmqctl.1.xml | 23 | ||||
| -rw-r--r-- | src/rabbit_binding.erl | 14 | ||||
| -rw-r--r-- | src/rabbit_control.erl | 22 |
3 files changed, 34 insertions, 25 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index ab16a532da..940bf6a8f1 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -894,16 +894,29 @@ </para> <variablelist> <varlistentry> - <term>source</term> - <listitem><para>The name and type of the source of + <term>source_name</term> + <listitem><para>The name of the source of messages to + which the binding is attached. With non-ASCII + characters escaped as in C.</para></listitem> + </varlistentry> + <varlistentry> + <term>source_kind</term> + <listitem><para>The kind of the source of messages to + which the binding is attached. Currently always + queue. With non-ASCII characters escaped as in + C.</para></listitem> + </varlistentry> + <varlistentry> + <term>destination_name</term> + <listitem><para>The name of the destination of messages to which the binding is attached. With non-ASCII characters escaped as in C.</para></listitem> </varlistentry> <varlistentry> - <term>destination</term> - <listitem><para>The type and name of the destination - of messages to which the binding is attached. With + <term>destination_kind</term> + <listitem><para>The kind of the destination of + messages to which the binding is attached. With non-ASCII characters escaped as in C.</para></listitem> </varlistentry> diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index eff93baff9..b12927e8ab 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -90,7 +90,9 @@ %%---------------------------------------------------------------------------- --define(INFO_KEYS, [source, destination, routing_key, arguments]). +-define(INFO_KEYS, [source_name, source_kind, + destination_name, destination_kind, + routing_key, arguments]). recover() -> rabbit_misc:table_fold( @@ -209,10 +211,12 @@ map(VHostPath, F) -> infos(Items, B) -> [{Item, i(Item, B)} || Item <- Items]. -i(source, #binding{source = SrcName}) -> SrcName; -i(destination, #binding{destination = DstName}) -> DstName; -i(routing_key, #binding{key = RoutingKey}) -> RoutingKey; -i(arguments, #binding{args = Arguments}) -> Arguments; +i(source_name, #binding{source = SrcName}) -> SrcName#resource.name; +i(source_kind, #binding{source = SrcName}) -> SrcName#resource.kind; +i(destination_name, #binding{destination = DstName}) -> DstName#resource.name; +i(destination_kind, #binding{destination = DstName}) -> DstName#resource.kind; +i(routing_key, #binding{key = RoutingKey}) -> RoutingKey; +i(arguments, #binding{args = Arguments}) -> Arguments; i(Item, _) -> throw({bad_argument, Item}). info(B = #binding{}) -> infos(?INFO_KEYS, B). diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index e7050ef02d..2d62b999f0 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -257,16 +257,12 @@ action(list_exchanges, Node, Args, Opts, Inform) -> action(list_bindings, Node, Args, Opts, Inform) -> Inform("Listing bindings", []), VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - FormatFun = fun (#resource{name = Name, kind = Kind}) -> - "{" ++ format_info_item(Kind) ++ ": " ++ - format_info_item(Name) ++ "}" - end, - ArgAtoms = default_if_empty(Args, [source, destination, + ArgAtoms = default_if_empty(Args, [source_name, source_kind, + destination_name, destination_kind, routing_key, arguments]), display_info_list(rpc_call(Node, rabbit_binding, info_all, [VHostArg, ArgAtoms]), - ArgAtoms, [{source, FormatFun}, - {destination, FormatFun}]); + ArgAtoms); action(list_connections, Node, Args, _Opts, Inform) -> Inform("Listing connections", []), @@ -316,18 +312,14 @@ default_if_empty(List, Default) when is_list(List) -> [list_to_atom(X) || X <- List] end. -display_info_list(Results, InfoItemKeys) -> - display_info_list(Results, InfoItemKeys, []). - -display_info_list(Results, InfoItemKeys, FormatFuns) when is_list(Results) -> +display_info_list(Results, InfoItemKeys) when is_list(Results) -> lists:foreach( fun (Result) -> - display_row( - [(proplists:get_value(X, FormatFuns, fun format_info_item/1))( - proplists:get_value(X, Result)) || X <- InfoItemKeys]) + display_row([format_info_item(proplists:get_value(X, Result)) + || X <- InfoItemKeys]) end, Results), ok; -display_info_list(Other, _, _) -> +display_info_list(Other, _) -> Other. display_row(Row) -> |
