func (c *Consumer) Stop() {
	close(c.quit)
	if !c.conn.IsClosed() {
		if err := c.channel.Cancel(c.consumerTag, true); err != nil {
			log.Println("rabbitmq consumer - channel cancel failed: ", err)
		}
		if err := c.conn.Close(); err != nil {
			log.Println("rabbitmq consumer - connection close failed: ", err)
		}
	}
}
Stop a consumer
package rabbitmq
import (
	"log"
	"time"
	"github.com/streadway/amqp"
)
type Consumer struct {
	addr          string
	conn          *amqp.Connection
	channel       *amqp.Channel
	connNotify    chan *amqp.Error
	channelNotify chan *amqp.Error
	quit          chan struct{}
	exchange      string
	routingKey    string
	queueName     string
	consumerTag   string
	autoDelete    bool                     
	handler       func(body []byte) error  
}
func NewConsumer(addr, exchange, queueName string, autoDelete bool, handler func(body []byte) error) *Consumer {
	return &Consumer{
		addr:        addr,
		exchange:    exchange,
		routingKey:  "",
		queueName:   queueName,
		consumerTag: "consumer",
		autoDelete:  autoDelete,
		handler:     handler,
		quit:        make(chan struct{}),
	}
}
func (c *Consumer) Start() error {
	if err := c.Run(); err != nil {
		return err
	}
	go c.ReConnect()
	return nil
}