修改xml消息在分发前一次转成MSG对象,避免后面业务反复做不必要的转换操作

This commit is contained in:
zhouxiunai
2019-01-08 15:44:59 +08:00
parent 3c7e55c2cc
commit f7fd218f93
11 changed files with 71 additions and 40 deletions
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gzzn.omms.msgexchangeapi.entity.Cminmsg;
import com.gzzn.omms.msgexchangeapi.entity.CminmsgWapper;
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
import com.gzzn.omms.msgexchangeapi.service.ICminmsgService;
import com.gzzn.omms.msgexchangeapi.service.exchange.IExchangeService;
@@ -27,13 +28,18 @@ public class MsgHandlerDispatcher {
{
try
{
//
MSG msg = exchangeService.xmlToMsg(cminmsg.getCminmsgsClobMsg());
CminmsgWapper cminmsgWapper = new CminmsgWapper(cminmsg);
cminmsgWapper.setMsg(msg);
String type = msg.getMETA().getTYPE().name();
String subType = msg.getMETA().getSTYP().name();
Class clazzHandler = Class.forName(getHandlerClassName(type,subType));
Object classObject = clazzHandler.newInstance();
Method runMethod = clazzHandler.getMethod("run", Cminmsg.class);
Method runMethod = clazzHandler.getMethod("run", CminmsgWapper.class);
HandlerResult result = (HandlerResult) runMethod.invoke(classObject, cminmsg);
return result;
} catch (Exception e) {