完成整体航班动态消息处理框架

This commit is contained in:
zhouxiunai
2018-12-04 14:53:50 +08:00
parent 747232bc89
commit 6c19f9ce4b
12 changed files with 286 additions and 18 deletions
@@ -8,14 +8,13 @@ import org.springframework.stereotype.Service;
import com.gzzn.omms.msgexchangeapi.entity.msg.Msg;
import com.gzzn.omms.msgexchangeapi.service.IExchangeService;
import com.gzzn.omms.msgexchangeapi.service.flightInfo.UpdateByCminmsgsResult;
@Service
public class MsgHandlerDispatcher {
@Autowired
IExchangeService exchangeService;
public UpdateByCminmsgsResult dispatch(String xmlMsg)
public HandlerResult dispatch(String xmlMsg)
{
Msg msg = exchangeService.xmlstrToObject(xmlMsg, Msg.class);
String type = msg.getMeta().getType();
@@ -26,7 +25,7 @@ public class MsgHandlerDispatcher {
Class clazzHandler = Class.forName(getHandlerClassName(type,subType));
Object classObject = clazzHandler.newInstance();
Method runMethod = clazzHandler.getMethod("run", String.class);
UpdateByCminmsgsResult result = (UpdateByCminmsgsResult) runMethod.invoke(classObject, xmlMsg);
HandlerResult result = (HandlerResult) runMethod.invoke(classObject, xmlMsg);
return result;
} catch (ClassNotFoundException
| InstantiationException
@@ -50,7 +49,7 @@ public class MsgHandlerDispatcher {
StringBuffer buffer = new StringBuffer();
buffer.append("com.gzzn.omms.msgexchangeapi.msghandler" );
buffer.append(".");
buffer.append(type);
buffer.append(type.toLowerCase());
buffer.append(".");
buffer.append(subType);
buffer.append("Handler");