diff options
author | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> | 2009-04-13 17:34:32 -0400 |
---|---|---|
committer | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> | 2009-04-13 17:34:32 -0400 |
commit | e6fae8eb21d6f52b810723d4edfc1be9a6d4ca2b (patch) | |
tree | eb7e89393c073b8ebc0345510c7fc8c5de7e245f /src/rabbit_channel.erl | |
parent | 0dfed790b7ab4cbf18b8837c2490f5b0fa46c805 (diff) | |
parent | 10c4786851c34472c3e93b37701409285e380dd1 (diff) | |
download | rabbitmq-server-e6fae8eb21d6f52b810723d4edfc1be9a6d4ca2b.tar.gz |
merge default into amqp_0_9_1
Diffstat (limited to 'src/rabbit_channel.erl')
-rw-r--r-- | src/rabbit_channel.erl | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index c43efbed..a9fcd8e0 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -259,10 +259,7 @@ expand_routing_key_shortcut(_QueueNameBin, RoutingKey, _State) -> RoutingKey. die_precondition_failed(Fmt, Params) -> - %% FIXME: 406 should be replaced with precondition_failed when we - %% move to AMQP spec >=8.1 - rabbit_misc:protocol_error({false, 406, <<"PRECONDITION_FAILED">>}, - Fmt, Params). + rabbit_misc:protocol_error(precondition_failed, Fmt, Params). %% check that an exchange/queue name does not contain the reserved %% "amq." prefix. @@ -299,9 +296,6 @@ handle_method(#'channel.close'{}, _, State = #ch{writer_pid = WriterPid}) -> ok = rabbit_writer:send_command(WriterPid, #'channel.close_ok'{}), stop; -handle_method(#'access.request'{},_, State) -> - {reply, #'access.request_ok'{ticket = 1}, State}; - handle_method(#'basic.publish'{exchange = ExchangeNameBin, routing_key = RoutingKey, mandatory = Mandatory, @@ -372,7 +366,7 @@ handle_method(#'basic.get'{queue = QueueNameBin, Content), {noreply, State1#ch{next_tag = DeliveryTag + 1}}; empty -> - {reply, #'basic.get_empty'{cluster_id = <<>>}, State} + {reply, #'basic.get_empty'{deprecated_cluster_id = <<>>}, State} end; handle_method(#'basic.consume'{queue = QueueNameBin, @@ -491,7 +485,7 @@ handle_method(#'basic.qos'{prefetch_count = PrefetchCount}, ok = rabbit_limiter:limit(NewLimiterPid, PrefetchCount), {reply, #'basic.qos_ok'{}, State#ch{limiter_pid = NewLimiterPid}}; -handle_method(#'basic.recover'{requeue = true}, +handle_method(#'basic.recover_async'{requeue = true}, _, State = #ch{ transaction_id = none, unacked_message_q = UAMQ }) -> ok = fold_per_queue( @@ -503,10 +497,11 @@ handle_method(#'basic.recover'{requeue = true}, rabbit_amqqueue:requeue( QPid, lists:reverse(MsgIds), self()) end, ok, UAMQ), - %% No answer required, apparently! + %% No answer required - basic.recover is the newer, synchronous + %% variant of this method {noreply, State#ch{unacked_message_q = queue:new()}}; -handle_method(#'basic.recover'{requeue = false}, +handle_method(#'basic.recover_async'{requeue = false}, _, State = #ch{ transaction_id = none, writer_pid = WriterPid, unacked_message_q = UAMQ }) -> @@ -528,10 +523,11 @@ handle_method(#'basic.recover'{requeue = false}, WriterPid, false, ConsumerTag, DeliveryTag, {QName, QPid, MsgId, true, Message}) end, queue:to_list(UAMQ)), - %% No answer required, apparently! + %% No answer required - basic.recover is the newer, synchronous + %% variant of this method {noreply, State}; -handle_method(#'basic.recover'{}, _, _State) -> +handle_method(#'basic.recover_async'{}, _, _State) -> rabbit_misc:protocol_error( not_allowed, "attempt to recover a transactional channel",[]); @@ -539,8 +535,8 @@ handle_method(#'exchange.declare'{exchange = ExchangeNameBin, type = TypeNameBin, passive = false, durable = Durable, - auto_delete = AutoDelete, - internal = false, + deprecated_auto_delete = false, %% 0-9-1: true not supported + deprecated_internal = false, %% 0-9-1: true not supported nowait = NoWait, arguments = Args}, _, State = #ch{ virtual_host = VHostPath }) -> @@ -554,7 +550,6 @@ handle_method(#'exchange.declare'{exchange = ExchangeNameBin, rabbit_exchange:declare(ExchangeName, CheckedType, Durable, - AutoDelete, Args) end, ok = rabbit_exchange:assert_type(X, CheckedType), @@ -776,14 +771,10 @@ deliver(QPids, Mandatory, Immediate, Txn, Message, WriterPid) -> case rabbit_router:deliver(QPids, Mandatory, Immediate, Txn, Message) of {ok, DeliveredQPids} -> DeliveredQPids; {error, unroutable} -> - %% FIXME: 312 should be replaced by the ?NO_ROUTE - %% definition, when we move to >=0-9 - ok = basic_return(Message, WriterPid, 312, <<"unroutable">>), + ok = basic_return(Message, WriterPid, ?NO_ROUTE, <<"unroutable">>), []; - {error, not_delivered} -> - %% FIXME: 313 should be replaced by the ?NO_CONSUMERS - %% definition, when we move to >=0-9 - ok = basic_return(Message, WriterPid, 313, <<"not_delivered">>), + {error, no_consumers} -> + ok = basic_return(Message, WriterPid, ?NO_CONSUMERS, <<"no_consumers">>), [] end. |