List of usage examples for javax.jms Message getJMSTimestamp
long getJMSTimestamp() throws JMSException;
From source file:org.springframework.integration.jms.DefaultJmsHeaderMapper.java
public Map<String, Object> toHeaders(javax.jms.Message jmsMessage) { Map<String, Object> headers = new HashMap<String, Object>(); try {// ww w. j a v a 2 s.co m try { String messageId = jmsMessage.getJMSMessageID(); if (messageId != null) { headers.put(JmsHeaders.MESSAGE_ID, messageId); } } catch (Exception e) { logger.info("failed to read JMSMessageID property, skipping", e); } try { String correlationId = jmsMessage.getJMSCorrelationID(); if (correlationId != null) { headers.put(JmsHeaders.CORRELATION_ID, correlationId); } } catch (Exception e) { logger.info("failed to read JMSCorrelationID property, skipping", e); } try { Destination replyTo = jmsMessage.getJMSReplyTo(); if (replyTo != null) { headers.put(JmsHeaders.REPLY_TO, replyTo); } } catch (Exception e) { logger.info("failed to read JMSReplyTo property, skipping", e); } try { headers.put(JmsHeaders.REDELIVERED, jmsMessage.getJMSRedelivered()); } catch (Exception e) { logger.info("failed to read JMSRedelivered property, skipping", e); } try { String type = jmsMessage.getJMSType(); if (type != null) { headers.put(JmsHeaders.TYPE, type); } } catch (Exception e) { logger.info("failed to read JMSType property, skipping", e); } try { headers.put(JmsHeaders.TIMESTAMP, jmsMessage.getJMSTimestamp()); } catch (Exception e) { logger.info("failed to read JMSTimestamp property, skipping", e); } Enumeration<?> jmsPropertyNames = jmsMessage.getPropertyNames(); if (jmsPropertyNames != null) { while (jmsPropertyNames.hasMoreElements()) { String propertyName = jmsPropertyNames.nextElement().toString(); try { String headerName = this.toHeaderName(propertyName); headers.put(headerName, jmsMessage.getObjectProperty(propertyName)); } catch (Exception e) { if (logger.isWarnEnabled()) { logger.warn("error occurred while mapping JMS property '" + propertyName + "' to Message header", e); } } } } } catch (JMSException e) { if (logger.isWarnEnabled()) { logger.warn("error occurred while mapping from JMS properties to MessageHeaders", e); } } return headers; }
From source file:org.springframework.jms.support.converter.SimpleJmsHeaderMapper.java
@Override public Map<String, Object> toHeaders(javax.jms.Message jmsMessage) { Map<String, Object> headers = new HashMap<String, Object>(); try {/* w w w . java2s .co m*/ try { String correlationId = jmsMessage.getJMSCorrelationID(); if (correlationId != null) { headers.put(JmsHeaders.CORRELATION_ID, correlationId); } } catch (Exception e) { logger.info("failed to read JMSCorrelationID property, skipping", e); } try { Destination destination = jmsMessage.getJMSDestination(); if (destination != null) { headers.put(JmsHeaders.DESTINATION, destination); } } catch (Exception e) { logger.info("failed to read JMSDestination property, skipping", e); } try { int deliveryMode = jmsMessage.getJMSDeliveryMode(); headers.put(JmsHeaders.DELIVERY_MODE, deliveryMode); } catch (Exception e) { logger.info("failed to read JMSDeliveryMode property, skipping", e); } try { long expiration = jmsMessage.getJMSExpiration(); headers.put(JmsHeaders.EXPIRATION, expiration); } catch (Exception e) { logger.info("failed to read JMSExpiration property, skipping", e); } try { String messageId = jmsMessage.getJMSMessageID(); if (messageId != null) { headers.put(JmsHeaders.MESSAGE_ID, messageId); } } catch (Exception e) { logger.info("failed to read JMSMessageID property, skipping", e); } try { headers.put(JmsHeaders.PRIORITY, jmsMessage.getJMSPriority()); } catch (Exception e) { logger.info("failed to read JMSPriority property, skipping", e); } try { Destination replyTo = jmsMessage.getJMSReplyTo(); if (replyTo != null) { headers.put(JmsHeaders.REPLY_TO, replyTo); } } catch (Exception e) { logger.info("failed to read JMSReplyTo property, skipping", e); } try { headers.put(JmsHeaders.REDELIVERED, jmsMessage.getJMSRedelivered()); } catch (Exception e) { logger.info("failed to read JMSRedelivered property, skipping", e); } try { String type = jmsMessage.getJMSType(); if (type != null) { headers.put(JmsHeaders.TYPE, type); } } catch (Exception e) { logger.info("failed to read JMSType property, skipping", e); } try { headers.put(JmsHeaders.TIMESTAMP, jmsMessage.getJMSTimestamp()); } catch (Exception e) { logger.info("failed to read JMSTimestamp property, skipping", e); } Enumeration<?> jmsPropertyNames = jmsMessage.getPropertyNames(); if (jmsPropertyNames != null) { while (jmsPropertyNames.hasMoreElements()) { String propertyName = jmsPropertyNames.nextElement().toString(); try { String headerName = this.toHeaderName(propertyName); headers.put(headerName, jmsMessage.getObjectProperty(propertyName)); } catch (Exception e) { if (logger.isWarnEnabled()) { logger.warn("error occurred while mapping JMS property '" + propertyName + "' to Message header", e); } } } } } catch (JMSException e) { if (logger.isWarnEnabled()) { logger.warn("error occurred while mapping from JMS properties to MessageHeaders", e); } } return headers; }
From source file:org.springframework.jms.support.SimpleJmsHeaderMapper.java
@Override public MessageHeaders toHeaders(javax.jms.Message jmsMessage) { Map<String, Object> headers = new HashMap<String, Object>(); try {/*from w ww. j av a2s. c om*/ try { String correlationId = jmsMessage.getJMSCorrelationID(); if (correlationId != null) { headers.put(JmsHeaders.CORRELATION_ID, correlationId); } } catch (Exception ex) { logger.info("failed to read JMSCorrelationID property, skipping", ex); } try { Destination destination = jmsMessage.getJMSDestination(); if (destination != null) { headers.put(JmsHeaders.DESTINATION, destination); } } catch (Exception ex) { logger.info("failed to read JMSDestination property, skipping", ex); } try { int deliveryMode = jmsMessage.getJMSDeliveryMode(); headers.put(JmsHeaders.DELIVERY_MODE, deliveryMode); } catch (Exception ex) { logger.info("failed to read JMSDeliveryMode property, skipping", ex); } try { long expiration = jmsMessage.getJMSExpiration(); headers.put(JmsHeaders.EXPIRATION, expiration); } catch (Exception ex) { logger.info("failed to read JMSExpiration property, skipping", ex); } try { String messageId = jmsMessage.getJMSMessageID(); if (messageId != null) { headers.put(JmsHeaders.MESSAGE_ID, messageId); } } catch (Exception ex) { logger.info("failed to read JMSMessageID property, skipping", ex); } try { headers.put(JmsHeaders.PRIORITY, jmsMessage.getJMSPriority()); } catch (Exception ex) { logger.info("failed to read JMSPriority property, skipping", ex); } try { Destination replyTo = jmsMessage.getJMSReplyTo(); if (replyTo != null) { headers.put(JmsHeaders.REPLY_TO, replyTo); } } catch (Exception ex) { logger.info("failed to read JMSReplyTo property, skipping", ex); } try { headers.put(JmsHeaders.REDELIVERED, jmsMessage.getJMSRedelivered()); } catch (Exception ex) { logger.info("failed to read JMSRedelivered property, skipping", ex); } try { String type = jmsMessage.getJMSType(); if (type != null) { headers.put(JmsHeaders.TYPE, type); } } catch (Exception ex) { logger.info("failed to read JMSType property, skipping", ex); } try { headers.put(JmsHeaders.TIMESTAMP, jmsMessage.getJMSTimestamp()); } catch (Exception ex) { logger.info("failed to read JMSTimestamp property, skipping", ex); } Enumeration<?> jmsPropertyNames = jmsMessage.getPropertyNames(); if (jmsPropertyNames != null) { while (jmsPropertyNames.hasMoreElements()) { String propertyName = jmsPropertyNames.nextElement().toString(); try { String headerName = this.toHeaderName(propertyName); headers.put(headerName, jmsMessage.getObjectProperty(propertyName)); } catch (Exception ex) { if (logger.isWarnEnabled()) { logger.warn("Error occurred while mapping JMS property '" + propertyName + "' to Message header", ex); } } } } } catch (JMSException ex) { if (logger.isWarnEnabled()) { logger.warn("Error occurred while mapping from JMS properties to MessageHeaders", ex); } } return new MessageHeaders(headers); }