mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-17 18:32:25 +08:00
feat:rpc gs增加gm接口
This commit is contained in:
10
gs/mq/mq.go
10
gs/mq/mq.go
@@ -1,7 +1,6 @@
|
||||
package mq
|
||||
|
||||
import (
|
||||
"hk4e/common/config"
|
||||
"hk4e/pkg/logger"
|
||||
"hk4e/protocol/cmd"
|
||||
|
||||
@@ -18,16 +17,11 @@ type MessageQueue struct {
|
||||
cmdProtoMap *cmd.CmdProtoMap
|
||||
}
|
||||
|
||||
func NewMessageQueue(netMsgInput chan *cmd.NetMsg, netMsgOutput chan *cmd.NetMsg) (r *MessageQueue) {
|
||||
func NewMessageQueue(conn *nats.Conn, netMsgInput chan *cmd.NetMsg, netMsgOutput chan *cmd.NetMsg) (r *MessageQueue) {
|
||||
r = new(MessageQueue)
|
||||
conn, err := nats.Connect(config.CONF.MQ.NatsUrl)
|
||||
if err != nil {
|
||||
logger.LOG.Error("connect nats error: %v", err)
|
||||
return nil
|
||||
}
|
||||
r.natsConn = conn
|
||||
r.natsMsgChan = make(chan *nats.Msg, 10000)
|
||||
_, err = r.natsConn.ChanSubscribe("GS_HK4E", r.natsMsgChan)
|
||||
_, err := r.natsConn.ChanSubscribe("GS_HK4E", r.natsMsgChan)
|
||||
if err != nil {
|
||||
logger.LOG.Error("nats subscribe error: %v", err)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user