List of usage examples for javax.jms MapMessage getJMSCorrelationID
String getJMSCorrelationID() throws JMSException;
From source file:eu.domibus.submission.jms.BackendJMSImpl.java
/** * This method is called when a message was received at the incoming queue * * @param message The incoming JMS Message *///from w ww . j a v a2 s . c o m @Override public void onMessage(final Message message) { final MapMessage map = (MapMessage) message; try { final Connection con = this.cf.createConnection(); final Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); final MapMessage res = session.createMapMessage(); try { final String messageID = this.submit(map); res.setStringProperty("messageId", messageID); } catch (final TransformationException | ValidationException e) { BackendJMSImpl.LOG.error("Exception occurred: ", e); res.setString("ErrorMessage", e.getMessage()); } res.setJMSCorrelationID(map.getJMSCorrelationID()); final MessageProducer sender = session.createProducer(this.outQueue); sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT); sender.send(res); sender.close(); session.close(); con.close(); } catch (final JMSException ex) { BackendJMSImpl.LOG.error("Error while sending response to queue", ex); } }