public void Publish(string topic, FsMessage msg) { if (_busReady && msg != null) { MsgBus.Publish(topic, msg.ToJson()); } else { log.ErrorFormat("Msgbus or msg is null."); return; } }
/// <summary> /// 发送请求 /// </summary> /// <param name="service">服务名称</param> /// <param name="request">消息</param> /// <param name="timeoutmsec">请求超时时间,单位:豪秒</param> /// <returns></returns> public FsMessage Request(string service, string request, int timeoutmsec) { if (_busReady && request != null) { string rsp = MsgBus.Request(service, request, timeoutmsec); return(FsMessage.FromJson(rsp)); } else { log.ErrorFormat("Msgbus or request is null."); return(null); } }