diff --git a/rabbitmq.go b/rabbitmq.go index 922866d..382aa90 100644 --- a/rabbitmq.go +++ b/rabbitmq.go @@ -52,6 +52,7 @@ func (r *rabbitmq) Consume(queueName string, autoAck bool, callback func(amqp.De if err != nil { return err } + defer ch.Close() //消费队列 msgs, err := ch.Consume( queueName, //队列名称