Compare commits

..

No commits in common. 'master' and 'v1.0.7' have entirely different histories.

@ -28,13 +28,9 @@ type Config struct {
} }
// InitRabbitmq @Title 初始化rabbitmq // InitRabbitmq @Title 初始化rabbitmq
func InitRabbitmq(config Config) error { func InitRabbitmq(config Config) (err error) {
Rabbitmq.config = config Rabbitmq.config = config
err := getConn() return getConn()
if err != nil && Rabbitmq.config.ReConn {
go reConn()
}
return err
} }
// @Title 获取连接 // @Title 获取连接
@ -110,11 +106,9 @@ func (r *rabbitmq) Publish(exchangeName, msg string, delay ...int64) error {
false, //强制为 false, //强制为
false, //立即 false, //立即
amqp.Publishing{ amqp.Publishing{
ContentType: "text/plain", ContentType: "text/plain",
Body: []byte(msg), Body: []byte(msg),
DeliveryMode: amqp.Persistent, Headers: header,
Timestamp: time.Now(),
Headers: header,
}) })
} }
@ -139,11 +133,9 @@ func (r *rabbitmq) PublishWithContext(ctx context.Context, exchangeName, key, ms
false, //强制为 false, //强制为
false, //立即 false, //立即
amqp.Publishing{ amqp.Publishing{
ContentType: "text/plain", ContentType: "text/plain",
DeliveryMode: amqp.Persistent, Body: []byte(msg),
Timestamp: time.Now(), Headers: header,
Body: []byte(msg),
Headers: header,
}) })
} }

Loading…
Cancel
Save