Example usage for javax.jms ObjectMessage getPropertyNames

List of usage examples for javax.jms ObjectMessage getPropertyNames

Introduction

In this page you can find the example usage for javax.jms ObjectMessage getPropertyNames.

Prototype


Enumeration getPropertyNames() throws JMSException;

Source Link

Document

Returns an Enumeration of all the property names.

Usage

From source file:org.apache.james.queue.jms.JMSMailQueue.java

/**
 * Create a copy of the given {@link Message}. This includes the properties
 * and the payload/*w w w . j a  va2 s  . com*/
 *
 * @param session
 * @param m
 * @return copy
 * @throws JMSException
 */
@SuppressWarnings("unchecked")
protected Message copy(Session session, Message m) throws JMSException {
    ObjectMessage message = (ObjectMessage) m;
    ObjectMessage copy = session.createObjectMessage(message.getObject());

    Enumeration<String> properties = message.getPropertyNames();
    while (properties.hasMoreElements()) {
        String name = properties.nextElement();
        copy.setObjectProperty(name, message.getObjectProperty(name));
    }

    return copy;
}

From source file:ru.runa.wfe.service.impl.ReceiveMessageBean.java

private Map<String, String> getRoutingData(ObjectMessage message) throws JMSException {
    Map<String, String> map = new HashMap<>();
    Enumeration<String> propertyNames = message.getPropertyNames();
    while (propertyNames.hasMoreElements()) {
        String propertyName = propertyNames.nextElement();
        if (!propertyName.startsWith("JMS")) {
            map.put(propertyName, message.getStringProperty(propertyName));
        }/*from www. ja  v  a2 s  .  co m*/
    }
    return map;
}