public static void copyProperties(Message inputMessage, Message outputMessage, List excludeProps) throws JMSException { if (inputMessage == null || outputMessage == null) { return; } Enumeration propNames = inputMessage.getPropertyNames(); while (propNames.hasMoreElements()) { String propName = (String) propNames.nextElement(); if (excludeProps == null || !excludeProps.contains(propName)) { Object value = getPropertyValue(propName, inputMessage); setProperty(propName, value, outputMessage); } } }
public static HashMap getAllProperties(Message jmsMessage) throws JMSException { HashMap props = new HashMap(); if (jmsMessage == null) { return props; } Enumeration propNames = jmsMessage.getPropertyNames(); while (propNames.hasMoreElements()) { String propName = (String) propNames.nextElement(); Object value = getPropertyValue(propName, jmsMessage); props.put(propName, value); } return props; }