Hi,
I configured MQ services in my project. I am listening to the message coming to MQ. When I receive to a message to MQ I want to copy the files over the network and after copying the files I want to send this information to a jsp page.
I am not sure how can I send any information to a jsp page from message listener class.
Here is my listener class code:
POJO class code:Code:public class SSMessageListener implements MessageListener { /** Logger for this class and subclasses */ protected final Log log = LogFactory.getLog(getClass()); private StatusRecordFileInfo srfInfo; public void onMessage(Message message) { if (message instanceof TextMessage) { try { String statusmsg = ((TextMessage)message).getText().toString(); log.info("Message: " + statusmsg); if(statusmsg != null && !statusmsg.equals("")) { srfInfo.setStatusfileName(statusmsg.toString()); log.info("Statusfile Name: " + srfInfo.getStatusfileName()); srfInfo.setControllerID(Integer.parseInt(statusmsg.substring(0, 3))); log.info("ControllerID: " + srfInfo.getControllerID()); srfInfo.setDayIndicator(Integer.parseInt(statusmsg.substring(3, 5))); log.info("Day Indicator: " + srfInfo.getDayIndicator()); srfInfo.setStepIndicator(Integer.parseInt(statusmsg.substring(5, 7))); log.info("Step Indicator: " + srfInfo.getStepIndicator()); } new FilesCopy().copy(statusmsg.toString()); setStatusRecordFileInfo(srfInfo); // FilesCopiedController fcc = new FilesCopiedController(); // fcc.setStatusRecordFileInfo(srfInfo); // fcc.handleRequest(req, res) } catch (JMSException ex) { throw new RuntimeException(ex); } } else { throw new IllegalArgumentException("Message must be of type TextMessage"); } } public void setStatusRecordFileInfo(StatusRecordFileInfo srfInfo) { this.srfInfo = srfInfo; } public StatusRecordFileInfo getStatusRecordFileInfo() { return srfInfo; } }
Code:public class StatusRecordFileInfo implements Serializable { /** * */ private static final long serialVersionUID = 663565464514740L; private Integer controllerID; private Integer dayIndicator; private Integer stepIndicator; private String statusfileName; private String statusfilePath; public void setControllerID(Integer controllerID) { this.controllerID = controllerID; } public Integer getControllerID() { return controllerID; } public void setDayIndicator(Integer dayIndicator) { this.dayIndicator = dayIndicator; } public Integer getDayIndicator() { return dayIndicator; } public void setStepIndicator(Integer stepIndicator) { this.stepIndicator = stepIndicator; } public Integer getStepIndicator() { return stepIndicator; } public void setStatusfileName(String statusfileName) { this.statusfileName = statusfileName; } public String getStatusfileName() { return statusfileName; } public void setStatusfilePath(String statusfilePath) { this.statusfilePath = statusfilePath; } public String getStatusfilePath() { return statusfilePath; } }
Files Copied Controller Code:
The problem here is I can't override onMessage method inherited from MessageListener.Code:public class FilesCopiedController implements Controller { private StatusRecordFileInfo srfInfo; public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws Exception { Map<String, Object> model = new HashMap<String, Object>(); model.put("srfInfo", getStatusRecordFileInfo()); return new ModelAndView("filescopied", "model", model); } public void setStatusRecordFileInfo(StatusRecordFileInfo srfInfo) { this.srfInfo = srfInfo; } public StatusRecordFileInfo getStatusRecordFileInfo() { return srfInfo; } }
Does any have a solution for this? If any one has solution please post your code here.
Thanks in advance. I really appreciate your fast response.
Thanks,
rsrch


Reply With Quote