diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-08-14 12:34:00 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-08-14 12:34:00 +0100 |
| commit | 2a1b088e419c3bd504e3394c8dd3cc4348005741 (patch) | |
| tree | bddce8c068abba0823260a5a59758f11415dcb6f | |
| parent | de45c3853174cf392cdde6f7869f0560aa8f4c66 (diff) | |
| download | rabbitmq-server-git-2a1b088e419c3bd504e3394c8dd3cc4348005741.tar.gz | |
Support cancel.
| -rw-r--r-- | src/rabbit_channel.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 772407ac54..b44d8a03a2 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 |
