diff --git a/servant/libservant/TarsNotify.cpp b/servant/libservant/TarsNotify.cpp index 60bfc73..7889e13 100644 --- a/servant/libservant/TarsNotify.cpp +++ b/servant/libservant/TarsNotify.cpp @@ -99,6 +99,35 @@ void TarsRemoteNotify::notify(NOTIFYLEVEL level, const string &sMessage) } } +void TarsRemoteNotify::report(const string &sMessage, const string & app, const string &serverName, const string &sNodeName) +{ + try + { + if(_notifyPrx) + { + ReportInfo info; + // info.eType = 0; + info.sApp = app; + info.sServer = serverName; + info.sSet = ""; + info.sThreadId = "";//TC_Common::tostr(pthread_self()); + info.sMessage = sMessage; + info.sNodeName = sNodeName; + // info.eLevel = level; + //_notifyPrx->async_notifyServer(NULL, _app + "." + _serverName, level, sMessage); + _notifyPrx->async_reportNotifyInfo(NULL, info); + } + } + catch(exception &ex) + { + TLOGERROR("TarsRemoteNotify::notify error:" << ex.what() << endl); + } + catch(...) + { + TLOGERROR("TarsRemoteNotify::notify unknown error" << endl); + } +} + } diff --git a/servant/servant/TarsNotify.h b/servant/servant/TarsNotify.h index 4e01611..f42db9e 100644 --- a/servant/servant/TarsNotify.h +++ b/servant/servant/TarsNotify.h @@ -58,6 +58,12 @@ public: */ void report(const string &sResult, bool bSync = false); + /** + * 指定通知到某个服务, 一定是异步上报的 + * @param message + */ + void report(const string &sMesage, const string & app, const string &serverName, const string &sNodeName); + protected: /** * 通信器