@Override
  public Set<String> getPropertyNames() {
    try {
      Set<SimpleString> simplePropNames = properties.getPropertyNames();
      Set<String> propNames = new HashSet<String>(simplePropNames.size());

      for (SimpleString str : simplePropNames) {
        propNames.add(str.toString());
      }
      return propNames;
    } catch (ActiveMQPropertyConversionException ce) {
      throw new MessageFormatRuntimeException(ce.getMessage());
    } catch (RuntimeException e) {
      throw new JMSRuntimeException(e.getMessage());
    }
  }
 /**
  * Sets all properties we carry onto the message.
  *
  * @param message
  * @throws JMSException
  */
 private void setProperties(Message message) throws JMSException {
   for (SimpleString name : properties.getPropertyNames()) {
     message.setObjectProperty(name.toString(), properties.getProperty(name));
   }
 }