123456789101112131415161718192021 |
- package Nats
- import (
- "Cold_GoodsOrder/conf"
- "Cold_GoodsOrder/lib"
- "fmt"
- "github.com/nats-io/nats.go"
- )
- func init() {
- fmt.Println("============Nats init============")
- var err error
- // 连接Nats服务器
- lib.Nats, err = nats.Connect("nats://" + conf.NatsServer_Url)
- if err != nil {
- fmt.Println("nats 连接失败!")
- panic(err)
- }
- fmt.Println("nats OK!")
- }
|