public static Set<String> getPropertyNames(Message message) { HashSet<String> set = new HashSet<String>(); for (SimpleString propName : message.getPropertyNames()) { if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME)) { set.add(propName.toString()); } } set.add(JMSXDELIVERYCOUNT); return set; }
public static void clearProperties(Message message) { List<SimpleString> toRemove = new ArrayList<SimpleString>(); for (SimpleString propName : message.getPropertyNames()) { if (!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) { toRemove.add(propName); } } for (SimpleString propName : toRemove) { message.removeProperty(propName); } }