diff options
| author | Ben Hood <0x6e6562@gmail.com> | 2008-08-06 00:41:30 +0100 |
|---|---|---|
| committer | Ben Hood <0x6e6562@gmail.com> | 2008-08-06 00:41:30 +0100 |
| commit | 1fd702693822ff7f754ac257c90a6a80b1453b4b (patch) | |
| tree | 83941e6a9dad9b0a076117125d2453b4ab0001b8 | |
| parent | 0c64f4a46e5a008831771ba8385727079c950548 (diff) | |
| download | rabbitmq-server-git-1fd702693822ff7f754ac257c90a6a80b1453b4b.tar.gz | |
queue.bind now works
| -rw-r--r-- | src/rabbit_amqqueue.erl | 25 | ||||
| -rw-r--r-- | src/rabbit_channel.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_exchange.erl | 1 |
3 files changed, 17 insertions, 11 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 4e94eecaa7..6341cd2e18 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -215,16 +215,23 @@ update_bindings(Q = #amqqueue{}, Spec, % {ok, Q1}; % Other -> Other % end. - + add_binding(QueueName, ExchangeName, RoutingKey, Arguments) -> - modify_bindings( - QueueName, ExchangeName, RoutingKey, Arguments, - fun (Q, _Spec) -> {ok, Q} end, - fun (Q, Spec) -> update_bindings( - Q, Spec, - fun (S, Specs) -> [S | Specs] end, - fun rabbit_exchange:add_binding/2) - end). + % Since this calls straight through to rabbit_exchange, + % can this exported function be deleted from this module? + F = fun() -> + rabbit_exchange:add_binding(#binding{exchange_name = ExchangeName, + key = RoutingKey, + queue_name = QueueName}) end, + rabbit_misc:execute_mnesia_transaction(F). + % modify_bindings( + % QueueName, ExchangeName, RoutingKey, Arguments, + % fun (Q, _Spec) -> {ok, Q} end, + % fun (Q, Spec) -> update_bindings( + % Q, Spec, + % fun (S, Specs) -> [S | Specs] end, + % fun rabbit_exchange:add_binding/2) + % end). delete_binding(QueueName, ExchangeName, RoutingKey, Arguments) -> modify_bindings( diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index b02a3c0a38..73ea552fd6 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -591,7 +591,7 @@ handle_method(#'queue.bind'{queue = QueueNameBin, rabbit_misc:protocol_error( not_allowed, "durability settings of ~s incompatible with ~s", [rabbit_misc:rs(QueueName), rabbit_misc:rs(ExchangeName)]); - {ok, _BindingCount} -> + ok -> return_ok(State, NoWait, #'queue.bind_ok'{}) end; diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index b84b817206..bdc0bf26a7 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -228,7 +228,6 @@ delivery_key_for_type(_Type, Name, RoutingKey) -> % Can this get refactored to to avoid the duplication of the lookup/1 function? call_with_exchange_and_queue(#binding{exchange_name = Exchange, queue_name = Queue}, Fun) -> - io:format("Reading (~p) and (~p) ~n",[Exchange,Queue]), case mnesia:wread({exchange, Exchange}) of [] -> {error, exchange_not_found}; [X] -> |
