List of usage examples for javax.jms Message getPropertyNames
Enumeration getPropertyNames() throws JMSException;
From source file:org.wso2.carbon.registry.event.core.internal.delivery.jms.JMSMessageListener.java
public void onMessage(Message message) { try {/*from w w w . jav a 2 s . c o m*/ PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(this.subscription.getTenantId()); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(this.subscription.getOwner()); PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; StAXOMBuilder stAXOMBuilder = new StAXOMBuilder( new ByteArrayInputStream(textMessage.getText().getBytes())); org.wso2.carbon.registry.event.core.Message messageToSend = new org.wso2.carbon.registry.event.core.Message(); messageToSend.setMessage(stAXOMBuilder.getDocumentElement()); // set the properties Enumeration propertyNames = message.getPropertyNames(); String key = null; while (propertyNames.hasMoreElements()) { key = (String) propertyNames.nextElement(); messageToSend.addProperty(key, message.getStringProperty(key)); } this.notificationManager.sendNotification(messageToSend, this.subscription); } else { log.warn("Non text message received"); } } catch (JMSException e) { log.error("Can not read the text message ", e); } catch (XMLStreamException e) { log.error("Can not build the xml string", e); } catch (EventBrokerException e) { log.error("Can not send the notification ", e); } finally { PrivilegedCarbonContext.endTenantFlow(); } }
From source file:org.mitre.mpf.markup.MarkupRequestConsumer.java
public void onMessage(Message message) { Stopwatch stopwatch = Stopwatch.createStarted(); if (message == null) { log.warn("Received a null JMS message. No action will be taken."); return;/* ww w. j a va2s .c o m*/ } if (!(message instanceof BytesMessage)) { log.warn("Received a JMS message, but it was not of the correct type. No action will be taken."); return; } try { log.info("Received JMS message. Type = {}. JMS Message ID = {}. JMS Correlation ID = {}.", message.getClass().getName(), message.getJMSMessageID(), message.getJMSCorrelationID()); final Map<String, Object> requestHeaders = new HashMap<String, Object>(); Enumeration<String> properties = message.getPropertyNames(); String propertyName = null; while (properties.hasMoreElements()) { propertyName = properties.nextElement(); requestHeaders.put(propertyName, message.getObjectProperty(propertyName)); } byte[] messageBytes = new byte[(int) (((BytesMessage) message).getBodyLength())]; ((BytesMessage) message).readBytes(messageBytes); Markup.MarkupRequest markupRequest = Markup.MarkupRequest.parseFrom(messageBytes); Markup.MarkupResponse.Builder markupResponseBuilder = initializeResponse(markupRequest); markupResponseBuilder.setRequestTimestamp(message.getJMSTimestamp()); log.debug("Processing markup request. Media Index = {}. Media ID = {} (type = {}). Request ID = {}.", markupRequest.getMediaIndex(), markupRequest.getMediaId(), markupRequest.getMediaType(), markupRequest.getRequestId()); try { if (!new File(URI.create(markupRequest.getDestinationUri())).canWrite()) { throw new Exception(); } } catch (Exception exception) { markupResponseBuilder.setHasError(true); markupResponseBuilder.setErrorMessage( String.format("The target URI '%s' is not writable.", markupRequest.getDestinationUri())); } try { if (!new File(URI.create(markupRequest.getSourceUri())).canRead()) { throw new Exception(); } } catch (Exception exception) { markupResponseBuilder.setHasError(true); markupResponseBuilder.setErrorMessage( String.format("The source URI '%s' is not readable.", markupRequest.getSourceUri())); } if (!markupResponseBuilder.getHasError()) { if (markupRequest.getMapEntriesCount() == 0) { try { FileUtils.copyFile(new File(URI.create(markupRequest.getSourceUri())), new File(URI.create(markupRequest.getDestinationUri()))); markupResponseBuilder.setOutputFileUri(markupRequest.getDestinationUri()); } catch (Exception exception) { log.error("Failed to mark up the file '{}' because of an exception.", markupRequest.getSourceUri(), exception); finishWithError(markupResponseBuilder, exception); } } else if (markupRequest.getMediaType() == Markup.MediaType.IMAGE) { try { if (markupImage(markupRequest)) { markupResponseBuilder.setOutputFileUri(markupRequest.getDestinationUri()); } else { markupResponseBuilder.setOutputFileUri(markupRequest.getSourceUri()); } } catch (Exception exception) { log.error("Failed to mark up the image '{}' because of an exception.", markupRequest.getSourceUri(), exception); finishWithError(markupResponseBuilder, exception); } } else { try { if (markupVideo(markupRequest)) { markupResponseBuilder.setOutputFileUri(markupRequest.getDestinationUri()); } else { markupResponseBuilder.setOutputFileUri(markupRequest.getDestinationUri()); } } catch (Exception exception) { log.error("Failed to mark up the video '{}' because of an exception.", markupRequest.getSourceUri(), exception); finishWithError(markupResponseBuilder, exception); } } } stopwatch.stop(); markupResponseBuilder.setTimeProcessing(stopwatch.elapsed(TimeUnit.MILLISECONDS)); final Markup.MarkupResponse markupResponse = markupResponseBuilder.build(); log.info("Returning response for Media {}. Error: {}.", markupResponse.getMediaId(), markupResponse.getHasError()); markupResponseTemplate.setSessionTransacted(true); markupResponseTemplate.setDefaultDestination(message.getJMSReplyTo()); markupResponseTemplate.send(new MessageCreator() { public Message createMessage(Session session) throws JMSException { BytesMessage bytesMessage = session.createBytesMessage(); bytesMessage.writeBytes(markupResponse.toByteArray()); for (Map.Entry<String, Object> entry : requestHeaders.entrySet()) { bytesMessage.setObjectProperty(entry.getKey(), entry.getValue()); } return bytesMessage; } }); } catch (Exception e) { log.error(e.getMessage(), e); } }
From source file:com.jmstoolkit.beans.MessageTableModel.java
/** * * @param message/*from ww w.j a v a 2s. c o m*/ */ @Override public void onMessage(Message message) { LOGGER.log(Level.FINE, "Message Received"); messagesReceived++; try { MessageTableRecord qRecord = new MessageTableRecord(); qRecord.setJMSCorrelationID(message.getJMSCorrelationID()); qRecord.setJMSDeliveryMode(message.getJMSDeliveryMode()); qRecord.setJMSExpiration(message.getJMSExpiration()); qRecord.setJMSMessageID(message.getJMSMessageID()); qRecord.setJMSTimestamp(message.getJMSTimestamp()); qRecord.setJMSType(message.getJMSType()); qRecord.setJMSDestination(message.getJMSDestination()); qRecord.setJMSCorrelationIDAsBytes(message.getJMSCorrelationIDAsBytes()); qRecord.setJMSPriority(message.getJMSPriority()); qRecord.setJMSType(message.getJMSType()); qRecord.setJMSReplyTo(message.getJMSReplyTo()); qRecord.setJMSRedelivered(message.getJMSRedelivered()); Enumeration pEnumerator = message.getPropertyNames(); Properties props = new Properties(); while (pEnumerator.hasMoreElements()) { String pElement = (String) pEnumerator.nextElement(); props.put(pElement, message.getStringProperty(pElement)); } qRecord.setProperties(props); if (message instanceof TextMessage) { qRecord.setText(((TextMessage) message).getText()); } if (message instanceof ObjectMessage) { qRecord.setObject(((ObjectMessage) message).getObject()); } List newData = data; newData.add(qRecord); this.setData(newData); } catch (JMSException e) { LOGGER.log(Level.WARNING, "JMS problem", e); } }
From source file:nl.nn.adapterframework.extensions.tibco.GetTibcoQueues.java
private String getQueueMessage(Session jSession, TibjmsAdmin admin, String queueName, int queueItem, LdapSender ldapSender) throws TibjmsAdminException, JMSException { QueueInfo qInfo = admin.getQueue(queueName); if (qInfo == null) { throw new JMSException(" queue [" + queueName + "] does not exist"); }/*from w ww. j av a 2 s .c om*/ XmlBuilder qMessageXml = new XmlBuilder("qMessage"); ServerInfo serverInfo = admin.getInfo(); String url = serverInfo.getURL(); qMessageXml.addAttribute("url", url); String resolvedUrl = getResolvedUrl(url); if (resolvedUrl != null) { qMessageXml.addAttribute("resolvedUrl", resolvedUrl); } qMessageXml.addAttribute("timestamp", DateUtils.getIsoTimeStamp()); qMessageXml.addAttribute("startTime", DateUtils.format(serverInfo.getStartTime(), DateUtils.fullIsoFormat)); XmlBuilder qNameXml = new XmlBuilder("qName"); qNameXml.setCdataValue(queueName); Queue queue = jSession.createQueue(queueName); QueueBrowser queueBrowser = null; try { queueBrowser = jSession.createBrowser(queue); Enumeration enm = queueBrowser.getEnumeration(); int count = 0; boolean found = false; String chompCharSizeString = AppConstants.getInstance().getString("browseQueue.chompCharSize", null); int chompCharSize = (int) Misc.toFileSize(chompCharSizeString, -1); while (enm.hasMoreElements() && !found) { count++; if (count == queueItem) { qNameXml.addAttribute("item", count); Object o = enm.nextElement(); if (o instanceof Message) { Message msg = (Message) o; XmlBuilder qMessageId = new XmlBuilder("qMessageId"); qMessageId.setCdataValue(msg.getJMSMessageID()); qMessageXml.addSubElement(qMessageId); XmlBuilder qTimestamp = new XmlBuilder("qTimestamp"); qTimestamp.setCdataValue(DateUtils.format(msg.getJMSTimestamp(), DateUtils.fullIsoFormat)); qMessageXml.addSubElement(qTimestamp); StringBuffer sb = new StringBuffer(""); Enumeration propertyNames = msg.getPropertyNames(); while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); Object object = msg.getObjectProperty(propertyName); if (sb.length() > 0) { sb.append("; "); } sb.append(propertyName); sb.append("="); sb.append(object); } XmlBuilder qPropsXml = new XmlBuilder("qProps"); qPropsXml.setCdataValue(sb.toString()); qMessageXml.addSubElement(qPropsXml); XmlBuilder qTextXml = new XmlBuilder("qText"); String msgText; try { TextMessage textMessage = (TextMessage) msg; msgText = textMessage.getText(); } catch (ClassCastException e) { msgText = msg.toString(); qTextXml.addAttribute("text", false); } int msgSize = msgText.length(); if (isHideMessage()) { qTextXml.setCdataValue("***HIDDEN***"); } else { if (chompCharSize >= 0 && msgSize > chompCharSize) { qTextXml.setCdataValue(msgText.substring(0, chompCharSize) + "..."); qTextXml.addAttribute("chomped", true); } else { qTextXml.setCdataValue(msgText); } } qMessageXml.addSubElement(qTextXml); XmlBuilder qTextSizeXml = new XmlBuilder("qTextSize"); qTextSizeXml.setValue(Misc.toFileSize(msgSize)); qMessageXml.addSubElement(qTextSizeXml); } found = true; } else { enm.nextElement(); } } } finally { if (queueBrowser != null) { try { queueBrowser.close(); } catch (JMSException e) { log.warn(getLogPrefix(null) + "exception on closing queue browser", e); } } } qMessageXml.addSubElement(qNameXml); Map aclMap = getAclMap(admin, ldapSender); XmlBuilder aclXml = new XmlBuilder("acl"); XmlBuilder qInfoXml = qInfoToXml(qInfo); aclXml.setValue((String) aclMap.get(qInfo.getName())); qInfoXml.addSubElement(aclXml); qMessageXml.addSubElement(qInfoXml); Map consumersMap = getConnectedConsumersMap(admin); XmlBuilder consumerXml = new XmlBuilder("connectedConsumers"); if (consumersMap.containsKey(qInfo.getName())) { LinkedList<String> consumers = (LinkedList<String>) consumersMap.get(qInfo.getName()); String consumersString = listToString(consumers); if (consumersString != null) { consumerXml.setCdataValue(consumersString); } } qInfoXml.addSubElement(consumerXml); return qMessageXml.toXML(); }
From source file:org.codehaus.stomp.jms.StompSession.java
protected void copyStandardHeadersFromMessageToFrame(Message message, StompFrame command) throws JMSException { final Map headers = command.getHeaders(); headers.put(Stomp.Headers.Message.DESTINATION, convertDestination(message.getJMSDestination())); headers.put(Stomp.Headers.Message.MESSAGE_ID, message.getJMSMessageID()); if (message.getJMSCorrelationID() != null) { headers.put(Stomp.Headers.Message.CORRELATION_ID, message.getJMSCorrelationID()); }/* w w w . j a v a2 s . c o m*/ headers.put(Stomp.Headers.Message.EXPIRATION_TIME, "" + message.getJMSExpiration()); if (message.getJMSRedelivered()) { headers.put(Stomp.Headers.Message.REDELIVERED, "true"); } headers.put(Stomp.Headers.Message.PRORITY, "" + message.getJMSPriority()); if (message.getJMSReplyTo() != null) { headers.put(Stomp.Headers.Message.REPLY_TO, convertDestination(message.getJMSReplyTo())); } headers.put(Stomp.Headers.Message.TIMESTAMP, "" + message.getJMSTimestamp()); if (message.getJMSType() != null) { headers.put(Stomp.Headers.Message.TYPE, message.getJMSType()); } // now lets add all the message headers Enumeration names = message.getPropertyNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); Object value = message.getObjectProperty(name); headers.put(name, value); } }
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 {/* www. j a va2 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:com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingWorker.java
private boolean verify(Message message, MsgCheck check) { String sVal = ""; if (check.getField().equals(MESSAGECONTENTFIELD)) { try {/*from w w w. ja v a2s . co m*/ if (message instanceof TextMessage) { sVal = ((TextMessage) message).getText(); } else if (message instanceof MapMessage) { MapMessage mm = (MapMessage) message; ObjectMapper mapper = new ObjectMapper(); ObjectNode root = mapper.createObjectNode(); @SuppressWarnings("unchecked") Enumeration<String> e = mm.getMapNames(); while (e.hasMoreElements()) { String field = e.nextElement(); root.set(field, mapper.convertValue(mm.getObject(field), JsonNode.class)); } sVal = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root); } else if (message instanceof BytesMessage) { BytesMessage bm = (BytesMessage) message; bm.reset(); byte[] bytes = new byte[(int) bm.getBodyLength()]; if (bm.readBytes(bytes) == bm.getBodyLength()) { sVal = new String(bytes); } } } catch (JMSException e) { return false; } catch (JsonProcessingException e) { return false; } } else { Enumeration<String> propNames = null; try { propNames = message.getPropertyNames(); while (propNames.hasMoreElements()) { String propertyName = propNames.nextElement(); if (propertyName.equals(check.getField())) { if (message.getObjectProperty(propertyName) != null) { sVal = message.getObjectProperty(propertyName).toString(); break; } } } } catch (JMSException e) { return false; } } String eVal = ""; if (check.getExpectedValue() != null) { eVal = check.getExpectedValue(); } if (Pattern.compile(eVal).matcher(sVal).find()) { return true; } return false; }
From source file:org.apache.camel.component.jms.JmsBinding.java
public Map<String, Object> extractHeadersFromJms(Message jmsMessage, Exchange exchange) { Map<String, Object> map = new HashMap<String, Object>(); if (jmsMessage != null) { // lets populate the standard JMS message headers try {/* w w w. ja v a 2s .c o m*/ map.put("JMSCorrelationID", jmsMessage.getJMSCorrelationID()); map.put("JMSDeliveryMode", jmsMessage.getJMSDeliveryMode()); map.put("JMSDestination", jmsMessage.getJMSDestination()); map.put("JMSExpiration", jmsMessage.getJMSExpiration()); map.put("JMSMessageID", jmsMessage.getJMSMessageID()); map.put("JMSPriority", jmsMessage.getJMSPriority()); map.put("JMSRedelivered", jmsMessage.getJMSRedelivered()); map.put("JMSTimestamp", jmsMessage.getJMSTimestamp()); // to work around OracleAQ not supporting the JMSReplyTo header (CAMEL-2909) try { map.put("JMSReplyTo", jmsMessage.getJMSReplyTo()); } catch (JMSException e) { LOG.trace("Cannot read JMSReplyTo header. Will ignore this exception.", e); } // to work around OracleAQ not supporting the JMSType header (CAMEL-2909) try { map.put("JMSType", jmsMessage.getJMSType()); } catch (JMSException e) { LOG.trace("Cannot read JMSType header. Will ignore this exception.", e); } // this works around a bug in the ActiveMQ property handling map.put("JMSXGroupID", jmsMessage.getStringProperty("JMSXGroupID")); } catch (JMSException e) { throw new RuntimeCamelException(e); } Enumeration names; try { names = jmsMessage.getPropertyNames(); } catch (JMSException e) { throw new RuntimeCamelException(e); } while (names.hasMoreElements()) { String name = names.nextElement().toString(); try { Object value = jmsMessage.getObjectProperty(name); if (headerFilterStrategy != null && headerFilterStrategy.applyFilterToExternalHeaders(name, value, exchange)) { continue; } // must decode back from safe JMS header name to original header name // when storing on this Camel JmsMessage object. String key = jmsKeyFormatStrategy.decodeKey(name); map.put(key, value); } catch (JMSException e) { throw new RuntimeCamelException(name, e); } } } return map; }
From source file:org.apache.axis2.transport.jms.JMSUtils.java
/** * Extract transport level headers for JMS from the given message into a Map * * @param message the JMS message//from w w w . j a va 2 s . c o m * @return a Map of the transport headers */ public static Map<String, Object> getTransportHeaders(Message message) { // create a Map to hold transport headers Map<String, Object> map = new HashMap<String, Object>(); // correlation ID try { if (message.getJMSCorrelationID() != null) { map.put(JMSConstants.JMS_COORELATION_ID, message.getJMSCorrelationID()); } } catch (JMSException ignore) { } // set the delivery mode as persistent or not try { map.put(JMSConstants.JMS_DELIVERY_MODE, Integer.toString(message.getJMSDeliveryMode())); } catch (JMSException ignore) { } // destination name try { if (message.getJMSDestination() != null) { Destination dest = message.getJMSDestination(); map.put(JMSConstants.JMS_DESTINATION, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // expiration try { map.put(JMSConstants.JMS_EXPIRATION, Long.toString(message.getJMSExpiration())); } catch (JMSException ignore) { } // if a JMS message ID is found try { if (message.getJMSMessageID() != null) { map.put(JMSConstants.JMS_MESSAGE_ID, message.getJMSMessageID()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_PRIORITY, Long.toString(message.getJMSPriority())); } catch (JMSException ignore) { } // redelivered try { map.put(JMSConstants.JMS_REDELIVERED, Boolean.toString(message.getJMSRedelivered())); } catch (JMSException ignore) { } // replyto destination name try { if (message.getJMSReplyTo() != null) { Destination dest = message.getJMSReplyTo(); map.put(JMSConstants.JMS_REPLY_TO, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_TIMESTAMP, Long.toString(message.getJMSTimestamp())); } catch (JMSException ignore) { } // message type try { if (message.getJMSType() != null) { map.put(JMSConstants.JMS_TYPE, message.getJMSType()); } } catch (JMSException ignore) { } // any other transport properties / headers Enumeration<?> e = null; try { e = message.getPropertyNames(); } catch (JMSException ignore) { } if (e != null) { while (e.hasMoreElements()) { String headerName = (String) e.nextElement(); try { map.put(headerName, message.getStringProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getBooleanProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getIntProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getLongProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getDoubleProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getFloatProperty(headerName)); } catch (JMSException ignore) { } } } return map; }
From source file:org.apache.synapse.transport.jms.JMSUtils.java
/** * Extract transport level headers for JMS from the given message into a Map * * @param message the JMS message/* ww w . j a va 2 s. co m*/ * @return a Map of the transport headers */ public static Map getTransportHeaders(Message message) { // create a Map to hold transport headers Map map = new HashMap(); // correlation ID try { if (message.getJMSCorrelationID() != null) { map.put(JMSConstants.JMS_COORELATION_ID, message.getJMSCorrelationID()); } } catch (JMSException ignore) { } // set the delivery mode as persistent or not try { map.put(JMSConstants.JMS_DELIVERY_MODE, Integer.toString(message.getJMSDeliveryMode())); } catch (JMSException ignore) { } // destination name try { if (message.getJMSDestination() != null) { Destination dest = message.getJMSDestination(); map.put(JMSConstants.JMS_DESTINATION, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // expiration try { map.put(JMSConstants.JMS_EXPIRATION, Long.toString(message.getJMSExpiration())); } catch (JMSException ignore) { } // if a JMS message ID is found try { if (message.getJMSMessageID() != null) { map.put(JMSConstants.JMS_MESSAGE_ID, message.getJMSMessageID()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_PRIORITY, Long.toString(message.getJMSPriority())); } catch (JMSException ignore) { } // redelivered try { map.put(JMSConstants.JMS_REDELIVERED, Boolean.toString(message.getJMSRedelivered())); } catch (JMSException ignore) { } // replyto destination name try { if (message.getJMSReplyTo() != null) { Destination dest = message.getJMSReplyTo(); map.put(JMSConstants.JMS_REPLY_TO, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_TIMESTAMP, Long.toString(message.getJMSTimestamp())); } catch (JMSException ignore) { } // message type try { if (message.getJMSType() != null) { map.put(JMSConstants.JMS_TYPE, message.getJMSType()); } } catch (JMSException ignore) { } // any other transport properties / headers Enumeration e = null; try { e = message.getPropertyNames(); } catch (JMSException ignore) { } if (e != null) { while (e.hasMoreElements()) { String headerName = (String) e.nextElement(); try { map.put(headerName, message.getStringProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, Boolean.valueOf(message.getBooleanProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Integer(message.getIntProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Long(message.getLongProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Double(message.getDoubleProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Float(message.getFloatProperty(headerName))); continue; } catch (JMSException ignore) { } } } return map; }