github.com/aaabigfish/gopkg@v1.1.0/mq/nsq/config.go (about) 1 package nsq 2 3 import ( 4 "github.com/nsqio/go-nsq" 5 ) 6 7 type NsqConfig = nsq.Config 8 type NsqMessage = nsq.Message 9 10 type Config struct { 11 topic string // 默认推送的topic,如果设置了发送消息就不用指定topic 12 NsqConfig *nsq.Config // nsq的配置 13 } 14 15 func NewConfig(topics ...string) *Config { 16 topic := "" 17 if len(topics) > 0 { 18 topic = topics[0] 19 } 20 return &Config{ 21 topic: topic, 22 NsqConfig: nsq.NewConfig(), 23 } 24 } 25 26 func NewNsqConfig() *nsq.Config { 27 return nsq.NewConfig() 28 }