diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-05-23 11:17:18 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-05-23 11:17:18 +0100 |
| commit | e8f6bada8543567580e948afefa68c1ab59b3f92 (patch) | |
| tree | 4b69fcfdd8d3d809c52f6bec1589d3a0f5ffba76 | |
| parent | 8b13d36eb49671fcfb39e4118f19db65852f48bc (diff) | |
| download | rabbitmq-server-git-e8f6bada8543567580e948afefa68c1ab59b3f92.tar.gz | |
Inline exchange/1, multihead publish/7
| -rw-r--r-- | src/rabbit_basic.erl | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl index 1c78172750..fa7e3a5ac0 100644 --- a/src/rabbit_basic.erl +++ b/src/rabbit_basic.erl @@ -162,29 +162,21 @@ publish(Exchange, RoutingKeyBin, Properties, Body) -> %% Convenience function, for avoiding round-trips in calls across the %% erlang distributed network. -publish(Exchange, RoutingKeyBin, Mandatory, Immediate, Txn, Properties, Body) -> - case exchange(Exchange) of - X = #exchange{name = XName} -> - publish(X, delivery(Mandatory, Immediate, Txn, - message(XName, RoutingKeyBin, - properties(Properties), Body), - undefined)); - Err -> - Err +publish(X = #exchange{name = XName}, RKey, Mandatory, Immediate, Txn, + Props, Body) -> + publish(X, delivery(Mandatory, Immediate, Txn, + message(XName, RKey, properties(Props), Body), + undefined)); +publish(XName, RKey, Mandatory, Immediate, Txn, Props, Body) -> + case rabbit_exchange:lookup(XName) of + {ok, X} -> publish(X, RKey, Mandatory, Immediate, Txn, Props, Body); + Err -> Err end. publish(X, Delivery) -> {RoutingRes, DeliveredQPids} = rabbit_exchange:publish(X, Delivery), {ok, RoutingRes, DeliveredQPids}. -exchange(X = #exchange{}) -> - X; -exchange(XName = #resource{kind = exchange}) -> - case rabbit_exchange:lookup(XName) of - {ok, X} -> X; - Err -> Err - end. - is_message_persistent(#content{properties = #'P_basic'{ delivery_mode = Mode}}) -> case Mode of |
