代码拉取完成,页面将自动刷新
package xmq
import (
"context"
config2 "gitee.com/xlizy/common-go/base/config"
"gitee.com/xlizy/common-go/base/enums/common_error"
"gitee.com/xlizy/common-go/base/response"
"gitee.com/xlizy/common-go/components/dubbo"
"gitee.com/xlizy/common-go/utils/common"
"gitee.com/xlizy/common-go/utils/zlog"
rpcApi "gitee.com/xlizy/rpc-interface/pbs"
)
var MQServiceClientImpl = new(rpcApi.MQServiceClientImpl)
func GetMQConsume() dubbo.Service {
return dubbo.Service{
Name: "MQServiceClientImpl",
InterfaceName: "com.rehod.mq.MQServiceClientImpl",
Interface: MQServiceClientImpl,
}
}
func Send(topic, msg string) *response.Response {
zlog.Info("发送MQ消息,topic:{},msg:{}", topic, msg)
rsp, err := MQServiceClientImpl.SendMQ(context.TODO(), &rpcApi.SendMQReq{
Topic: topic,
Msg: msg,
ClientIp: common.GetLocalPriorityIp(config2.PriorityNetwork.Networks),
AppName: config2.GetNacosCfg().AppName,
})
if err != nil {
zlog.Error("发送MQ失败:{}", err.Error())
return response.Error(common_error.RPC_CALL_ERROR, nil)
}
if rsp.Success {
zlog.Error("发送MQ成功")
return response.Succ()
} else {
zlog.Error("发送MQ失败:{}", rsp.Msg)
return response.ErrorCus(rsp.Code, rsp.Msg, nil)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。