title: rabbitMQ AlreadyClosedException when basicAck(knowledging)
body: <p>My groovy code uses the Rabbit Native Plugin for grails:     </p>
  
  <pre><code>def handleMessage(def body, MessageContext context) {
      // With noAck=false, messages must be acknowledged manually with basic.ack.
      boolean noAck = false
      // send Ack on true and nack on false
      if(processMessage(new SensorEvent(body))){
             context.channel.basicAck(context.getEnvelope().getDeliveryTag(),noAck)
      }else{
          context.channel.basicNack(context.getEnvelope().getDeliveryTag(), false, false);
  
      }
      return ''
  }
  </code></pre>
  
  <p>If I comment out the two lines of code that do the Ack and Nack everything works fine.  If I uncomment the basicAck I get the following exception</p>
  
  <pre><code>com.rabbitmq.client.AlreadyClosedException: channel is already closed due to channel error; protocol method: #method&lt;channel.close&gt;(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
  at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:195)
  at com.rabbitmq.client.impl.AMQChannel.transmit(AMQChannel.java:309)
  at com.rabbitmq.client.impl.AMQChannel.transmit(AMQChannel.java:303)
  at com.rabbitmq.client.impl.ChannelN.basicReject(ChannelN.java:1045)
  at com.rabbitmq.client.impl.recovery.RecoveryAwareChannelN.basicReject(RecoveryAwareChannelN.java:72)
  at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicReject(AutorecoveringChannel.java:354)
  </code></pre>
  
  <p>I've seen advice saying to use the Subscription.Ack().  There is no Subscription class in the Java/Groovy rabbitMQ.</p>
  
  <p>Any idea why I'm getting the exception?  </p>
  
  <p>Edit: since I'm using the Native Plugin I needed to create a consumer that implemented the interface  </p>
  
  <pre><code>def handleMessage(def body, MessageContext context)
  </code></pre>
  
  <p>The subscribing is handled with:</p>
  
  <pre><code> /**
   * Consumer configuration.
   */
  static rabbitConfig = [
          "queue": "my.queueName"
  ]
  </code></pre>