@asyncio.coroutine<EOL><INDENT>def cancel(self):<DEDENT>
self.sender.send_BasicCancel(self.tag)<EOL>try:<EOL><INDENT>yield from self.synchroniser.wait(spec.BasicCancelOK)<EOL><DEDENT>except AMQPError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>self.reader.ready()<EOL><DEDENT>self.cancelled = True<EOL>self.cancelled_future.set_result(self)<EOL>if hasattr(self.callback, '<STR_LIT>'):<EOL><INDENT>self.callback.on_cancel()<EOL><DEDENT>
Cancel the consumer and stop recieving messages.

This method is a :ref:`coroutine <coroutine>`.