重构消息处理框架ExchangeTask 只做新消息获取和分发
This commit is contained in:
@@ -8,9 +8,9 @@ import org.slf4j.LoggerFactory;
|
||||
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.msg.Msg;
|
||||
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
|
||||
import com.gzzn.omms.msgexchangeapi.utils.JsonUtil;
|
||||
|
||||
@Service
|
||||
public class MsgHandlerDispatcher {
|
||||
@@ -19,9 +19,9 @@ public class MsgHandlerDispatcher {
|
||||
@Autowired
|
||||
IExchangeService exchangeService;
|
||||
|
||||
public HandlerResult dispatch(String xmlMsg)
|
||||
public HandlerResult dispatch(Cminmsg cminmsg)
|
||||
{
|
||||
Msg msg = exchangeService.xmlstrToObject(xmlMsg, Msg.class);
|
||||
Msg msg = exchangeService.xmlstrToObject(cminmsg.getCminmsgsClobMsg(), Msg.class);
|
||||
String type = msg.getMeta().getType();
|
||||
String subType = msg.getMeta().getStyp();
|
||||
|
||||
@@ -29,8 +29,8 @@ public class MsgHandlerDispatcher {
|
||||
{
|
||||
Class clazzHandler = Class.forName(getHandlerClassName(type,subType));
|
||||
Object classObject = clazzHandler.newInstance();
|
||||
Method runMethod = clazzHandler.getMethod("run", String.class);
|
||||
HandlerResult result = (HandlerResult) runMethod.invoke(classObject, xmlMsg);
|
||||
Method runMethod = clazzHandler.getMethod("run", Cminmsg.class);
|
||||
HandlerResult result = (HandlerResult) runMethod.invoke(classObject, cminmsg);
|
||||
return result;
|
||||
} catch (ClassNotFoundException
|
||||
| InstantiationException
|
||||
|
||||
Reference in New Issue
Block a user