}
public boolean routeMessage(Message inMessage, String messageDetailsType,
Long irmtabRef, String msgType, String msgSource) {
// long startTime = new Date().getTime();
EntDbMsgTelex msgTelex = new EntDbMsgTelex();
EntDbMsgTelex msgTelexInsrt = new EntDbMsgTelex();
msgLogged = Boolean.FALSE;
logLevel = _startupInitSingleton.getIrmLogLev();
if (irmtabRef > 0) {
msgLogged = Boolean.TRUE;
}
try {
fillIdFlightFromMsg(inMessage,messageDetailsType, irmtabRef, msgLogged,
msgTelex, msgSource, msgType);
if (msgTelex.getMsgFltno() == null
|| msgTelex.getIdFlight() == null) {
LOG.error("Invalid Message.");
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(inMessage, dtflStr);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EWVAL, "Invalid Message",
irmtabRef);
}
return true;
}
if (msgTelex.getIdFlight().equals(BigDecimal.ZERO)) {
LOG.error("No flight found in the AFTTAB.");
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(inMessage, dtflStr);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.WNOFL, "Flight num:"
+ msgTelex.getMsgFltno() + " Flight DAY: "
+ msgTelex.getMsgFltDay(), irmtabRef);
}
}
msgTelex.setRecStatus(" ");
msgTelex.setDataSource(HpEKConstants.LOAD_CONTROL_MSG);
msgTelexInsrt = msgTelexBean.updateMsgTelex(msgTelex);
if (msgTelexInsrt != null) {
/*
* sendLoadBagUpdateToCedaInJson(loadBagStat, oldLoadBag,
* UfisASCommands.URT.name(), true);
*/
if (HpUfisUtils.isNotEmptyStr(HpCommonConfig.notifyTopic)) {
// send notification message to topic
ufisTopicProducer.sendNotification(true,
UfisASCommands.IRT,
String.valueOf(msgTelexInsrt.getIdFlight()), null,
msgTelexInsrt);
}
if (HpUfisUtils.isNotEmptyStr(HpCommonConfig.notifyQueue)) {
// if topic not defined, send
// notification to queue
ufisQueueProducer.sendNotification(true,
UfisASCommands.IRT,
String.valueOf(msgTelexInsrt.getIdFlight()), null,
msgTelexInsrt);
}
LOG.debug("Msg Telex communicated to Ceda.");
} else {
LOG.error("Error inserting Telex msg to DB.");