/** * Don't create a new object each time. * @return */ public BaseMessage getMessageObject() { if (m_message == null) { Map<String,Object> properties = new Hashtable<String,Object>(); m_message = new MapMessage(new BaseMessageHeader(BACKUP_QUEUE_NAME, BACKUP_QUEUE_TYPE, this, null), properties); } return m_message; } /**
/** * Constructor. */ public void init(BaseMessageHeader messageHeader) { super.init(messageHeader, null); } /**
/** * Free Method. */ public void free() { super.free(); } /**
for (int i = 1; ; i++) String strProcessClass = (String)((MapMessage)message).get(DBParams.PROCESS + Integer.toString(i)); if (strProcessClass == null) break; // End of initial processes properties.remove(MessageInfoApplication.AUTOSTART); properties.put(DBParams.PROCESS, strProcessClass); BaseMessage messageInitial = new MapMessage(new BaseMessageHeader(message.getMessageHeader().getQueueName(), message.getMessageHeader().getQueueType(), this, null), properties); env.getMessageManager(m_application, true).sendMessage(messageInitial); // Resend it! (Don't consume it!)
/** * Get the raw data for this (xpath) key. * @param strParam The xpath key. * @return The raw data at this location in the message. */ public Object get(String strParam) { Object objValue = super.get(strParam); if (objValue == null) if (MessageConstants.MESSAGE_TYPE_PARAM.equals(strParam)) objValue = Integer.toString(((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType()); return objValue; } /**
/** * Get the message data as a XML String. * @return The XML String. */ public String getXML(boolean bIncludeHeader) { if (bIncludeHeader == false) { if (ManualMessage.MANUAL_MESSAGE_CODE.equals(this.get(TrxMessageHeader.MESSAGE_CODE))); { String strMessage = this.getString(ManualMessage.MESSAGE_PARAM); if (strMessage.startsWith("<")) return strMessage; } } return super.getXML(bIncludeHeader); } }
for (int i = 1; ; i++) String strProcessClass = (String)((MapMessage)message).get(DBParams.PROCESS + Integer.toString(i)); if (strProcessClass == null) break; // End of initial processes properties.remove(MessageApplication.AUTOSTART); properties.put(DBParams.PROCESS, strProcessClass); BaseMessage messageInitial = new MapMessage(new BaseMessageHeader(message.getMessageHeader().getQueueName(), message.getMessageHeader().getQueueType(), this, null), properties); env.getMessageManager(m_application, true).sendMessage(messageInitial); // Resend it! (Don't consume it!)
/** * Get the raw data for this (xpath) key. * @param strParam The xpath key. * @return The raw data at this location in the message. */ public Object get(String strParam) { Object objValue = super.get(strParam); if (objValue == null) if (MessageConstants.MESSAGE_TYPE_PARAM.equals(strParam)) objValue = Integer.toString(((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType()); return objValue; } /**
/** * Get the message data as a XML String. * @return The XML String. */ public String getXML(boolean bIncludeHeader) { if (bIncludeHeader == false) { if (ManualMessage.MANUAL_MESSAGE_CODE.equals(this.get(TrxMessageHeader.MESSAGE_CODE))); { String strMessage = this.getString(ManualMessage.MESSAGE_PARAM); if (strMessage.startsWith("<")) return strMessage; } } return super.getXML(bIncludeHeader); } }
/** * Don't create a new object each time. * @return */ public BaseMessage getMessageObject() { if (m_message == null) { Map<String,Object> properties = new Hashtable<String,Object>(); m_message = new MapMessage(new BaseMessageHeader(BACKUP_QUEUE_NAME, BACKUP_QUEUE_TYPE, this, null), properties); } return m_message; } /**
/** * Initialize class fields. */ public void init(BaseMessageHeader messageHeader, Object data) { super.init(messageHeader, data); } /**
/** * Free this object. */ public void free() { super.free(); } /**
/** * Don't create a new object each time. * @return */ public BaseMessage getMessageObject() { if (m_message == null) { Map<String,Object> properties = new Hashtable<String,Object>(); m_message = new MapMessage(new BaseMessageHeader(BACKUP_QUEUE_NAME, BACKUP_QUEUE_TYPE, this, null), properties); } return m_message; } /**
/** * Constructor. */ public void init(BaseMessageHeader messageHeader) { super.init(messageHeader, null); } /**
/** * Free this object. */ public void free() { super.free(); } /**
/** * StartProcess Method. */ public void startProcess(String strProcessName, int iCount) { Map<String,Object> properties = new HashMap<String,Object>(); properties.put(DBParams.PROCESS, strProcessName); properties.put(DBParams.TABLE, this.getProperty(DBParams.TABLE)); properties.put("count", iCount); Application app = (Application)this.getTask().getApplication(); String strQueueName = MessageConstants.TRX_SEND_QUEUE; String strQueueType = MessageConstants.INTRANET_QUEUE; BaseMessage message = new MapMessage(new TrxMessageHeader(strQueueName, strQueueType, properties), properties); app.getMessageManager().sendMessage(message); }
/** * Initialize new BaseTrxMessage. * @param objRawMessage The (optional) raw data of the message. */ public void init(BaseMessageHeader messageHeader, Map<String,Object> mapRawMessage, String strMessage) { if (mapRawMessage == null) mapRawMessage = new HashMap<String,Object>(); mapRawMessage.put(TrxMessageHeader.MESSAGE_CODE, ManualMessage.MANUAL_MESSAGE_CODE); mapRawMessage.put(ManualMessage.MESSAGE_PARAM, strMessage); // The physical message super.init(messageHeader, mapRawMessage); } /**
/** * Process this internal message. * @param internalMessage The message to process. * @return (optional) The return message if applicable. */ public BaseMessage processMessage(BaseMessage internalMessage) { String strRoomType = (String)internalMessage.get("rateType"); String strRoomClass = (String)internalMessage.get("roomClass"); // Add code to lookup hotel rate here try { java.lang.Thread.currentThread().sleep(5000); // Simulate time for message turnaround } catch (InterruptedException ex) { } BaseMessage replyMessage = new MapMessage(); replyMessage.put(DBParams.FIELD, "multipleFields"); replyMessage.put("CityOrTown", "Los Angeles"); replyMessage.put("Contact", "Fred"); //? this.sendMessage(new BaseMessage(null, replyMessage)); return null; // No reply expected }
/** * Initialize new BaseTrxMessage. * @param objRawMessage The (optional) raw data of the message. */ public void init(BaseMessageHeader messageHeader, Map<String,Object> mapRawMessage, String strMessage) { if (mapRawMessage == null) mapRawMessage = new HashMap<String,Object>(); mapRawMessage.put(TrxMessageHeader.MESSAGE_CODE, ManualMessage.MANUAL_MESSAGE_CODE); mapRawMessage.put(ManualMessage.MESSAGE_PARAM, strMessage); // The physical message super.init(messageHeader, mapRawMessage); } /**
/** * Stop this thread. */ public void stopThisThread() { super.stopThisThread(); // Set the flag to stop this thread. // Now, send a message which will be received by this thread; since continueLooping is off, this thread will stop. ((LocalMessageQueue)this.getMessageQueue()).getMessageStack().sendMessage(new MapMessage(null, null)); } /**