diagnose用于单据消息转储
2013-10-20 12:04
513 查看
1.简介
diagnose插件目前可用于单据接收方报文存储,转储文件可用于问题诊断(如界定是否是通信问题).未来扩展:
.增强捕获条件配置:如仅捕获特定发送机构的单据,或者支持非单据消息.(可引入sheet_catcher的机制)
2.配置(diagnose.conf)
<?xml version="1.0" encoding="gb2312" standalone="yes"?> <config> <dbc>laton</dbc> <dump_path>data\dump_bill</dump_path> <!-- 转储目录--> </config>
<dump_path>目录必须存在.
3.实现代码
//////////////////////////////////////////////////////////////////////////////// int CDiagnose::Activate() { parent::Activate(); router_->RegisterInterceptor(::MsgInterceptCheck,::MsgIntercept); return 0; } //////////////////////////////////////////////////////////////////////////////// bool CDiagnose::MsgInterceptCheck(CMsg *msg) { MSGTYPE msg_type = msg->GetMsgType(); MSGID msg_id = msg->GetMsgID(); return (msg_type==MT_INDICATION&&msg_id==2800); } //////////////////////////////////////////////////////////////////////////////// int CDiagnose::MsgIntercept(CMsg *msg) { const char *sz_sheet_type = msg->GetParam("f006n_0031"); const char *sz_sheet_id = msg->GetParam("f011v_0031"); const char *sz_src_orgid = msg->GetParam("Src_orgid"); if (sz_sheet_type==0||sz_sheet_id==0||sz_src_orgid==0) { nlogger_->log(LO_STDOUT|LO_FILE,SEVERITY_ERROR,"消息包无效.\n"); return -1; } ///< 文件名:源机构_单据类型_单据编号.dat string fn = LogMsg("%s%s_%s_%s.dat",dump_path_.c_str(),sz_src_orgid,sz_sheet_type,sz_sheet_id); if (Dump(fn.c_str(),msg)) { nlogger_->log(LO_STDOUT|LO_FILE,SEVERITY_ERROR,"写文件%s失败,错误码:%d.\n",fn.c_str(),GetLastError()); return -1; } return 0; ///< 继续处理 }
相关文章推荐
- 行列有序矩阵求第k大元素
- 39-4
- ACL
- すべての始まり~~开始学习Python Cookbook
- 适配器模式
- Ubuntu 配置 samba 实现文件夹共享
- Linux信号集 —— Signal set and using
- jdk-6u45-linux-x64.bin
- requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found
- 习题2-6
- socket.io发送给指定的客户端
- 教你向面试官提问(应对“你有什么问题要问我的吗?”)
- 关于面向对象思想中二维数组如何与对象映射思路的思考
- Hadoop集群_安装配置
- hbase安装配置(整合到hadoop)
- 关于酷派8730“移动版”手机无法将应用安装在外置SD卡的解决办法和获取ROOT权限方法
- java 自定义线程池
- 解决wordpress3.5安装插件和主题失败的问题
- HDFS架构图_Apache/百度/腾讯
- 关于docx,html,xhtml,pdf直接转换