diff --git a/rabbitmq.go b/rabbitmq.go index 474e440..6d66c22 100644 --- a/rabbitmq.go +++ b/rabbitmq.go @@ -28,9 +28,13 @@ type Config struct { } // InitRabbitmq @Title 初始化rabbitmq -func InitRabbitmq(config Config) (err error) { +func InitRabbitmq(config Config) error { Rabbitmq.config = config - return getConn() + err := getConn() + if err != nil && Rabbitmq.config.ReConn { + go reConn() + } + return err } // @Title 获取连接