summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-08-14 12:34:00 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-08-14 12:34:00 +0100
commit1623a337ee71257d823f7b41726e6ed4d561ed13 (patch)
treebddce8c068abba0823260a5a59758f11415dcb6f /src
parent4b13fab65c2bd6292336add89c041c8f79d618ac (diff)
downloadrabbitmq-server-1623a337ee71257d823f7b41726e6ed4d561ed13.tar.gz
Support cancel.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_channel.erl10
1 files changed, 9 insertions, 1 deletions
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