12345678910111213141516171819 |
- package nats
- import (
- "context"
- "github.com/nats-io/nats.go"
- "project_management/global"
- "project_management/simple_zap"
- )
- var Nats *nats.Conn
- func SetupNats() {
- var err error
- Nats, err = nats.Connect(global.NatsSetting.NatsServerUrl)
- if err != nil {
- simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "nats 连接失败")
- panic(err)
- }
- }
|