Package ek.lcm.loadControlMessage

Examples of ek.lcm.loadControlMessage.LoadControlMsgType


  }

  public boolean routeMessage(Message inMessage, String message,
      Long irmtabRef) {
    long startTime = new Date().getTime();
    LoadControlMsgType loadControlMsg;// = new LoadControlMsgType();
    // ObjectMapper objectMapper = new ObjectMapper();

    String dtflString = _startupInitSingleton.getDtflStr();
    msgLogged = Boolean.FALSE;
    logLevel = _startupInitSingleton.getIrmLogLev();
    if (irmtabRef > 0) {
      msgLogged = Boolean.TRUE;
    }
    try {
      JAXBElement<LoadControlMsgType> data = _um.unmarshal(
          new StreamSource(new StringReader(message)),
          LoadControlMsgType.class);
      LOG.info(" Data Declared Type: {}", data.getDeclaredType());
      LOG.info(" Data Name: {}", data.getName());
      LOG.info(" Data Value: {}", data.getValue());
      loadControlMsg = (LoadControlMsgType) data.getValue();
      if (loadControlMsg == null) {
        LOG.info(" Dropping the message. Message is Empty. MSG : {}",
            loadControlMsg);
        if (logLevel
            .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                .name())) {
          if (!msgLogged) {
            irmtabRef = _irmfacade.storeRawMsg(inMessage,
                dtflString);
            msgLogged = Boolean.TRUE;
          }
        }
        if (irmtabRef > 0) {
          sendErrInfo(EnumExceptionCodes.EXSDF, "Message is Empty",
              irmtabRef);

        }
        return false;
      }
     
      if (loadControlMsg.getMeta() == null
          || loadControlMsg.getMessageDetails() == null){// HpUfisUtils.isNullOrEmptyStr(loadControlMsg.getMessageDetails())) {
        LOG.info(
            " Dropping the message. Meta: {} or Message Details: {} are empty.",
            loadControlMsg.getMeta(),
            loadControlMsg.getMessageDetails());
        if (logLevel
            .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                .name())) {
          if (!msgLogged) {
            irmtabRef = _irmfacade.storeRawMsg(inMessage,
                dtflString);
            msgLogged = Boolean.TRUE;
          }
        }
        if (irmtabRef > 0) {
          sendErrInfo(EnumExceptionCodes.EXSDF,
              "Meta or Message Details are empty", irmtabRef);

        }
        return false;
      }
      if (loadControlMsg.getMeta().getMessageTime() == null
          || HpUfisUtils.isNullOrEmptyStr(loadControlMsg.getMeta()
              .getMessageType())
          || HpUfisUtils.isNullOrEmptyStr(loadControlMsg.getMeta()
              .getMessageSubtype())
          || HpUfisUtils.isNullOrEmptyStr(loadControlMsg.getMeta()
              .getMessageSource())) {
        LOG.info(
            " Dropping the message. Meta section mandatory fields(MessageTime,MessageType,MessageSubType,essageSource) are empty. MSG : {}",
            message);
        if (logLevel
            .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                .name())) {
          if (!msgLogged) {
            irmtabRef = _irmfacade.storeRawMsg(inMessage,
                dtflString);
            msgLogged = Boolean.TRUE;
          }
        }
        if (irmtabRef > 0) {
          sendErrInfo(
              EnumExceptionCodes.EXSDF,
              "Meta section mandatory fields(MessageTime,MessageType,MessageSubType,essageSource) are empty",
              irmtabRef);

        }
        return false;
      }
      if (!loadControlMsg.getMeta().getMessageTime().isValid()) {
        LOG.info(
            " Dropping the message. Message Time is not Valid. MSG : {}",
            loadControlMsg.getMeta().getMessageTime());
        if (logLevel
            .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                .name())) {
          if (!msgLogged) {
            irmtabRef = _irmfacade.storeRawMsg(inMessage,
                dtflString);
            msgLogged = Boolean.TRUE;
          }
        }
        if (irmtabRef > 0) {
          sendErrInfo(EnumExceptionCodes.EWFMT,
              "Message Time is not Valid.", irmtabRef);
        }
        return false;
      }

      /*
       * LOG.info("Start sending message to AMQ..."); TextMessage msg =
       * session.createTextMessage();
       *
       * objectMapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
       * objectMapper
       * .writeValueAsString(loadControlMsg.getMessageDetails());
       * ObjectMessage msg=session.createObjectMessage();
       * msg.setObject(loadControlMsg.getMessageDetails());
       *
       *
       * String str = loadControlMsg.getMessageDetails();
       * LOG.info("String:" + str); str = formatMsg(str,
       * loadControlMsg.getMeta().getMessageType(),
       * loadControlMsg.getMeta().getMessageSource(), loadControlMsg
       * .getMeta().getMessageSubtype()); msg.setText(str); for
       * (MessageProducer msgProd : messageProducerList) {
       * msgProd.send(msg); }
       * LOG.debug("!!!Sent a {} message to AMQ Queue : {}",
       * loadControlMsg .getMeta().getMessageType(), queueName);
       */     
      _blLCMBean.routeMessage(inMessage,
          loadControlMsg.getMessageDetails(), irmtabRef,
          loadControlMsg.getMeta().getMessageType(),loadControlMsg.getMeta().getMessageSource());

      LOG.info("Time For Processing Message:"
          + (new Date().getTime() - startTime));

      return true;
View Full Code Here

TOP

Related Classes of ek.lcm.loadControlMessage.LoadControlMsgType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.