From 1623a337ee71257d823f7b41726e6ed4d561ed13 Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Thu, 14 Aug 2014 12:34:00 +0100 Subject: Support cancel. --- src/rabbit_channel.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 772407ac..b44d8a03 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -809,7 +809,6 @@ handle_method(#'basic.get'{queue = QueueNameBin, no_ack = NoAck}, {reply, #'basic.get_empty'{}, State} end; -%% TODO we should support cancel! handle_method(#'basic.consume'{queue = <<"amq.rabbitmq.reply-to">>, consumer_tag = CTag0, no_ack = NoAck, @@ -845,6 +844,15 @@ handle_method(#'basic.consume'{queue = <<"amq.rabbitmq.reply-to">>, not_allowed, "attempt to reuse consumer tag '~s'", [CTag0]) end; +handle_method(#'basic.cancel'{consumer_tag = ConsumerTag, nowait = NoWait}, + _, State = #ch{reply_consumer = {ConsumerTag, _}}) -> + State1 = State#ch{reply_consumer = none}, + case NoWait of + true -> {noreply, State1}; + false -> Rep = #'basic.cancel_ok'{consumer_tag = ConsumerTag}, + {reply, Rep, State1} + end; + handle_method(#'basic.consume'{queue = QueueNameBin, consumer_tag = ConsumerTag, no_local = _, % FIXME: implement -- cgit v1.2.1