title: Pika-RabbitMQ: how to make a completion callback with nowait==False (re. channels in Django)?
body: <p>I have a problem with implementing django-channels with RabbitMQ channel layer. I'd finished RabbitMQ tutorial and ran through Vincent Zhang's <a href="https://github.com/VincentTide/django-channels-celery-example" rel="nofollow noreferrer">example1</a>  and few other examples without any problem, but stumbled upon the implementation of Andy Goodwin's <a href="https://github.com/andrewgodwin/channels-examples" rel="nofollow noreferrer">example2</a> databinding example. The problem seems to be with Pika module.</p>
  
  <p>At first, pika==0.10.0 raised the following exception:</p>
  
  <pre><code>pika.exceptions.ChannelClosed: (404, "NOT_FOUND - no exchange 'binding.enquirer' in vhost '/'")
  </code></pre>
  
  <p>After upgrading pika to 0.11.0b1 the exception changed to</p>
  
  <pre><code>ValueError: Must have completion callback with nowait=False
  </code></pre>
  
  <p>Tracing back to pika's source code (channel.py), it seems that the method responsible for canceling the consumer, <em>basic_cancel</em>, has the follwing parameters:</p>
  
  <pre><code>nowait==False
  callback is None
  </code></pre>
  
  <p>which isn't acceptable by the program. I don't know how to solve this. Here's my code (nothing beyond Andy's example, really):</p>
  
  <p><strong>consumers.py</strong></p>
  
  <pre><code>class Demultiplexer(WebsocketDemultiplexer):
      consumers = {
          "taxpayer": TaxpayerBinding.consumer,
      }
      groups = ["binding.enquirer"]
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Taxpayer(models.Model):
      ...
  
  class TaxpayerBinding(WebsocketBinding):
      model = Taxpayer
      stream = "taxpayer"
      fields = ["taxpayer_id", "checksum_status", "name"]
  
      @classmethod
      def group_names(cls, *args, **kwargs):
          return ["binding.enquirer"]
      def has_permission(self, user, action, pk):
          return True
  </code></pre>
  
  <p><strong>routing.py</strong></p>
  
  <pre><code>channel_routing = [
      route_class(Demultiplexer, path="^/binding/"),
  </code></pre>
  
  <p>The html template and javascript inside is a mess right now, so unless crucial to solving this problem, I'd rather not show it right now (I do not know js at all, so I'll probably ask someone for help or make it another question, but I don't want to mix the two topics if not related). Please let me know, if those problems are connected and I will edit this question.</p>
  
  <p>P.S. I'm a newbie so I'd be glad for any comments that will allow me to better understand what is going on. The broader the answers, the better. Thanks.</p>