Example usage for javax.jms ObjectMessage getObjectProperty

List of usage examples for javax.jms ObjectMessage getObjectProperty

Introduction

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

Prototype


Object getObjectProperty(String name) throws JMSException;

Source Link

Document

Returns the value of the Java object property with the specified name.

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//from  w  w  w. jav  a  2 s  . c  o m
 *
 * @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;
}