Example usage for javax.jms Message setIntProperty

List of usage examples for javax.jms Message setIntProperty

Introduction

In this page you can find the example usage for javax.jms Message setIntProperty.

Prototype


void setIntProperty(String name, int value) throws JMSException;

Source Link

Document

Sets an int property value with the specified name into the message.

Usage

From source file:org.apache.qpid.disttest.client.MessageProvider.java

protected void setCustomProperty(Message message, String propertyName, Object propertyValue)
        throws JMSException {
    if (propertyValue instanceof Integer) {
        message.setIntProperty(propertyName, ((Integer) propertyValue).intValue());
    } else if (propertyValue instanceof Long) {
        message.setLongProperty(propertyName, ((Long) propertyValue).longValue());
    } else if (propertyValue instanceof Boolean) {
        message.setBooleanProperty(propertyName, ((Boolean) propertyValue).booleanValue());
    } else if (propertyValue instanceof Byte) {
        message.setByteProperty(propertyName, ((Byte) propertyValue).byteValue());
    } else if (propertyValue instanceof Double) {
        message.setDoubleProperty(propertyName, ((Double) propertyValue).doubleValue());
    } else if (propertyValue instanceof Float) {
        message.setFloatProperty(propertyName, ((Float) propertyValue).floatValue());
    } else if (propertyValue instanceof Short) {
        message.setShortProperty(propertyName, ((Short) propertyValue).shortValue());
    } else if (propertyValue instanceof String) {
        message.setStringProperty(propertyName, (String) propertyValue);
    } else {//w  ww .  j ava 2  s  .  co m
        message.setObjectProperty(propertyName, propertyValue);
    }
}

From source file:org.apache.qpid.systest.management.jmx.QueueManagementTest.java

@Override
public Message createNextMessage(Session session, int messageNumber) throws JMSException {
    Message message = session.createTextMessage(getContentForMessageNumber(messageNumber));
    message.setIntProperty(INDEX, messageNumber);
    return message;
}

From source file:org.apache.qpid.test.utils.QpidBrokerTestCase.java

public Message createNextMessage(Session session, int msgCount) throws JMSException
{
    Message message = createMessage(session, _messageSize);
    message.setIntProperty(INDEX, msgCount);

    return message;

}

From source file:org.apache.synapse.message.store.impl.jms.JmsProducer.java

private void setJmsMessageProperties(Message message, MessageContext synCtx) {
    Set<String> properties = synCtx.getPropertyKeySet();
    for (String prop : properties) {
        if (prop.startsWith(JMS_MSG_P)) {
            Object value = synCtx.getProperty(prop);
            String key = prop.substring(JMS_MSG_P.length());
            try {
                if (value instanceof String) {
                    message.setStringProperty(key, (String) value);
                } else if (value instanceof Long) {
                    message.setLongProperty(key, (Long) value);
                } else if (value instanceof Integer) {
                    message.setIntProperty(key, (Integer) value);
                } else if (value instanceof Boolean) {
                    message.setBooleanProperty(key, (Boolean) value);
                } else if (value instanceof Double) {
                    message.setDoubleProperty(key, (Double) value);
                } else if (value instanceof Float) {
                    message.setFloatProperty(key, (Float) value);
                } else if (value instanceof Short) {
                    message.setShortProperty(key, (Short) value);
                }//from  w  w w  .j  a  v a 2  s. c  o  m
            } catch (JMSException e) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Could not save Message property: " + e.getLocalizedMessage());
                }
            }
        }
    }
}

From source file:org.apache.synapse.message.store.impl.jms.JmsProducer.java

private void setTransportHeaders(Message message, MessageContext synCtx) {
    //Set transport headers to the message
    Map<?, ?> headerMap = (Map<?, ?>) ((Axis2MessageContext) synCtx).getAxis2MessageContext()
            .getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
    if (headerMap != null) {
        for (Object headerName : headerMap.keySet()) {
            String name = (String) headerName;
            Object value = headerMap.get(name);
            try {
                if (value instanceof String) {
                    message.setStringProperty(name, (String) value);
                } else if (value instanceof Boolean) {
                    message.setBooleanProperty(name, (Boolean) value);
                } else if (value instanceof Integer) {
                    message.setIntProperty(name, (Integer) value);
                } else if (value instanceof Long) {
                    message.setLongProperty(name, (Long) value);
                } else if (value instanceof Double) {
                    message.setDoubleProperty(name, (Double) value);
                } else if (value instanceof Float) {
                    message.setFloatProperty(name, (Float) value);
                }//from   w w  w  . j a va2s.co  m
            } catch (JMSException ex) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Could not save Message property: " + ex.getLocalizedMessage());
                }
            }
        }
    }
}

From source file:org.apache.synapse.transport.jms.JMSUtils.java

/**
 * Set transport headers from the axis message context, into the JMS message
 *
 * @param msgContext the axis message context
 * @param message the JMS Message/*from  ww w .  ja v  a  2 s  . c om*/
 * @throws JMSException on exception
 */
public static void setTransportHeaders(MessageContext msgContext, Message message) throws JMSException {

    Map headerMap = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);

    if (headerMap == null) {
        return;
    }

    Iterator iter = headerMap.keySet().iterator();
    while (iter.hasNext()) {

        String name = (String) iter.next();

        if (JMSConstants.JMS_COORELATION_ID.equals(name)) {
            message.setJMSCorrelationID((String) headerMap.get(JMSConstants.JMS_COORELATION_ID));
        } else if (JMSConstants.JMS_DELIVERY_MODE.equals(name)) {
            Object o = headerMap.get(JMSConstants.JMS_DELIVERY_MODE);
            if (o instanceof Integer) {
                message.setJMSDeliveryMode(((Integer) o).intValue());
            } else if (o instanceof String) {
                try {
                    message.setJMSDeliveryMode(Integer.parseInt((String) o));
                } catch (NumberFormatException nfe) {
                    log.warn("Invalid delivery mode ignored : " + o, nfe);
                }
            } else {
                log.warn("Invalid delivery mode ignored : " + o);
            }
        } else if (JMSConstants.JMS_EXPIRATION.equals(name)) {
            message.setJMSExpiration(Long.parseLong((String) headerMap.get(JMSConstants.JMS_EXPIRATION)));
        } else if (JMSConstants.JMS_MESSAGE_ID.equals(name)) {
            message.setJMSMessageID((String) headerMap.get(JMSConstants.JMS_MESSAGE_ID));
        } else if (JMSConstants.JMS_PRIORITY.equals(name)) {
            message.setJMSPriority(Integer.parseInt((String) headerMap.get(JMSConstants.JMS_PRIORITY)));
        } else if (JMSConstants.JMS_TIMESTAMP.equals(name)) {
            message.setJMSTimestamp(Long.parseLong((String) headerMap.get(JMSConstants.JMS_TIMESTAMP)));
        } else if (JMSConstants.JMS_MESSAGE_TYPE.equals(name)) {
            message.setJMSType((String) headerMap.get(JMSConstants.JMS_MESSAGE_TYPE));
        } else {
            Object value = headerMap.get(name);
            if (value instanceof String) {
                message.setStringProperty(name, (String) value);
            } else if (value instanceof Boolean) {
                message.setBooleanProperty(name, ((Boolean) value).booleanValue());
            } else if (value instanceof Integer) {
                message.setIntProperty(name, ((Integer) value).intValue());
            } else if (value instanceof Long) {
                message.setLongProperty(name, ((Long) value).longValue());
            } else if (value instanceof Double) {
                message.setDoubleProperty(name, ((Double) value).doubleValue());
            } else if (value instanceof Float) {
                message.setFloatProperty(name, ((Float) value).floatValue());
            }
        }
    }
}

From source file:org.openanzo.combus.CombusConnection.java

/**
 * Send a request to a destination and wait for a response
 * /*from  w  w w.j av a  2s  .c  o  m*/
 * @param context
 *            context for this operational call
 * @param destinationName
 *            destination queue for this request
 * @param request
 *            request message
 * @param timeout
 *            timeout for waiting for a response
 * @return response message
 * @throws AnzoException
 *             if there was an exception sending request, or a timeout waiting for a response
 */
public TextMessage requestResponse(IOperationContext context, String destinationName, Message request,
        long timeout) throws AnzoException {
    Destination destination = null;

    if (context.getAttribute(OPTIONS.DATASOURCE) != null) {
        URI datasourceUri = (URI) context.getAttribute(OPTIONS.DATASOURCE);
        Queue defaultDestination = (Queue) destinations.get(destinationName);
        if (datasourceUri.toString().equals("http://openanzo.org/datasource/systemDatasource")) {
            destination = defaultDestination;
        } else {
            String queueNamePrefix = UriGenerator.generateEncapsulatedString("", datasourceUri.toString())
                    + "/";
            try {
                String[] parts = StringUtils.split(defaultDestination.getQueueName(), '/');
                String queue = "services/" + queueNamePrefix + parts[1];
                destination = destinations.get(queue);
                if (destination == null) {
                    destination = session.createQueue(queue);
                    destinations.put(queue, destination);
                }
            } catch (JMSException e) {
                throw new AnzoException(ExceptionConstants.COMBUS.NO_SUCH_DESTINATION, destinationName);
            }
        }
    } else {
        destination = destinations.get(destinationName);
        if (destination == null) {
            throw new AnzoException(ExceptionConstants.COMBUS.NO_SUCH_DESTINATION, destinationName);
        }
    }

    if (context.getAttribute(COMBUS.TIMEOUT) != null) {
        timeout = (Long) context.getAttribute(COMBUS.TIMEOUT);
    }

    String correlationId = context.getOperationId();
    if (correlationId == null) {
        correlationId = UUID.randomUUID().toString();
    }

    try {
        request.setJMSCorrelationID(correlationId);
        request.setJMSReplyTo(tempQueue);
        request.setIntProperty(SerializationConstants.protocolVersion, Constants.VERSION);
        if (context.getOperationPrincipal() != null
                && !context.getOperationPrincipal().getName().equals(this.userName)) {
            request.setStringProperty(SerializationConstants.runAsUser,
                    context.getOperationPrincipal().getName());
        }
        if (context.getAttribute(OPTIONS.PRIORITY) != null) {
            Integer priority = (Integer) context.getAttribute(OPTIONS.PRIORITY);
            request.setJMSPriority(priority);
            messageProducer.setPriority(priority);
        } else {
            messageProducer.setPriority(4);
        }
        if (context.getAttribute(OPTIONS.SKIPCACHE) != null) {
            request.setBooleanProperty(OPTIONS.SKIPCACHE,
                    context.getAttribute(OPTIONS.SKIPCACHE, Boolean.class));
        }
        if (log.isTraceEnabled()) {
            log.trace(LogUtils.COMBUS_MARKER,
                    MessageUtils.prettyPrint(request, "Sending Request: (destination=" + destination + ")"));
        }
        messageProducer.send(destination, request);
    } catch (JMSException jmsex) {
        performDisconnect(true);
        throw new AnzoException(ExceptionConstants.COMBUS.COULD_NOT_PUBLISH, jmsex);
    }
    lock.lock();
    try {
        Collection<TextMessage> messageSet = correlationIdToMessage.remove(correlationId);
        long start = System.currentTimeMillis();
        while (messageSet == null) {
            if (timeout <= 0) {
                try {
                    newMessage.await(2, TimeUnit.SECONDS);
                } catch (InterruptedException ie) {
                    throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                }
                if (closed || closing) {
                    throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                }
                messageSet = correlationIdToMessage.remove(correlationId);
            } else {
                try {
                    newMessage.await(timeout, TimeUnit.MILLISECONDS);
                } catch (InterruptedException ie) {
                    throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                }
                if (closed || closing) {
                    throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                }
                messageSet = correlationIdToMessage.remove(correlationId);
                if (!connected) {
                    log.error(LogUtils.COMBUS_MARKER, "Request Response failed because connection was closed");
                    throw new AnzoException(ExceptionConstants.COMBUS.JMS_NOT_CONNECTED, correlationId);
                }
                if (messageSet == null && ((timeout > 0) && ((System.currentTimeMillis() - start) > timeout))) {
                    throw new AnzoException(ExceptionConstants.COMBUS.NO_SERVER_RESPONSE, correlationId);
                }
            }
        }
        try {
            TextMessage message = messageSet.iterator().next();
            if (log.isTraceEnabled()) {
                log.trace(LogUtils.COMBUS_MARKER, MessageUtils.prettyPrint(message, "Received Response:"));
            }

            if (message.getBooleanProperty(SerializationConstants.operationFailed)) {
                long errorCodes = message.propertyExists(SerializationConstants.errorTags)
                        ? message.getLongProperty(SerializationConstants.errorCode)
                        : ExceptionConstants.COMBUS.JMS_SERVICE_EXCEPTION;

                // if available, use enumerated args, since these can be reconstruct an AnzoException correctly.
                List<String> args = new ArrayList<String>();
                for (int i = 0; true; i++) {
                    String errorArg = message.getStringProperty(SerializationConstants.errorMessageArg + i);
                    if (errorArg == null) {
                        break;
                    }
                    args.add(errorArg);
                }

                // NOTE: This doesn't really make any sense, but it was here before and it's better to be too verbose than not verbose enough
                // when it comes to error messages, so it stays.  For now at least. -jpbetz
                if (args.isEmpty()) {
                    args.add(message.getText());
                }
                throw new AnzoException(errorCodes, args.toArray(new String[0]));
            }
            /*Object prp = context.getAttribute("populateResponseProperties");
            if (prp != null && ((Boolean) prp)) {
            HashMap<String, Object> props = new HashMap<String, Object>();
            Enumeration<String> keys = message.getPropertyNames();
            while (keys.hasMoreElements()) {
                String key = keys.nextElement();
                props.put(key, message.getObjectProperty(key));
            }
            context.setAttribute("responseProperties", props);
            }*/
            return message;
        } catch (JMSException jmsex) {
            log.debug(LogUtils.COMBUS_MARKER, Messages.formatString(
                    ExceptionConstants.COMBUS.ERROR_PROCESSING_MESSGE, "request response"), jmsex);
        }
        return null;
    } finally {
        lock.unlock();
    }
}

From source file:org.openanzo.combus.CombusConnection.java

/**
 * Send a request to a destination and wait for a response
 * //from ww w  .j av  a 2 s  .  c  o  m
 * @param context
 *            context for this operational call
 * @param destinationName
 *            destination queue for this request
 * @param request
 *            request message
 * @param timeout
 *            timeout for waiting for a response
 * @param messageHandler
 *            the handler of multiple messages
 * @throws AnzoException
 *             if there was an exception sending request, or a timeout waiting for a response
 */
public void requestMultipleResponse(IOperationContext context, String destinationName, Message request,
        long timeout, IMessageHandler messageHandler) throws AnzoException {
    Destination destination = null;
    if (context.getAttribute(OPTIONS.DATASOURCE) != null) {
        URI datasourceUri = (URI) context.getAttribute(OPTIONS.DATASOURCE);
        Queue defaultDestination = (Queue) destinations.get(destinationName);
        if (datasourceUri.toString().equals("http://openanzo.org/datasource/systemDatasource")) {
            destination = defaultDestination;
        } else {
            String queueNamePrefix = UriGenerator.generateEncapsulatedString("", datasourceUri.toString())
                    + "/";
            try {
                String[] parts = StringUtils.split(defaultDestination.getQueueName(), '/');
                String queue = "services/" + queueNamePrefix + parts[1];
                destination = destinations.get(queue);
                if (destination == null) {
                    destination = session.createQueue(queue);
                    destinations.put(queue, destination);
                }
            } catch (JMSException e) {
                throw new AnzoException(ExceptionConstants.COMBUS.NO_SUCH_DESTINATION, destinationName);
            }
        }
    } else {
        destination = destinations.get(destinationName);
        if (destination == null) {
            throw new AnzoException(ExceptionConstants.COMBUS.NO_SUCH_DESTINATION, destinationName);
        }
    }
    String correlationId = context.getOperationId();
    if (correlationId == null) {
        correlationId = UUID.randomUUID().toString();
    }

    try {
        request.setJMSCorrelationID(correlationId);
        request.setJMSReplyTo(tempQueue);
        request.setIntProperty(SerializationConstants.protocolVersion, Constants.VERSION);
        if (context.getOperationPrincipal() != null
                && !context.getOperationPrincipal().getName().equals(this.userName)) {
            request.setStringProperty(SerializationConstants.runAsUser,
                    context.getOperationPrincipal().getName());
        }
        if (context.getAttribute(OPTIONS.PRIORITY) != null) {
            Integer priority = (Integer) context.getAttribute(OPTIONS.PRIORITY);
            request.setJMSPriority(priority);
            messageProducer.setPriority(priority);
        } else {
            messageProducer.setPriority(4);
        }
        if (context.getAttribute(OPTIONS.SKIPCACHE) != null) {
            request.setBooleanProperty(OPTIONS.SKIPCACHE,
                    context.getAttribute(OPTIONS.SKIPCACHE, Boolean.class));
        }
        if (context.getAttribute(OPTIONS.INCLUDEMETADATAGRAPHS) != null) {
            request.setBooleanProperty(OPTIONS.INCLUDEMETADATAGRAPHS,
                    context.getAttribute(OPTIONS.INCLUDEMETADATAGRAPHS, Boolean.class));
        }
        if (log.isTraceEnabled()) {
            log.trace(LogUtils.COMBUS_MARKER,
                    MessageUtils.prettyPrint(request, "Sending Request: (destination=" + destination + ")"));
        }
        messageProducer.send(destination, request);
    } catch (JMSException jmsex) {
        performDisconnect(true);
        throw new AnzoException(ExceptionConstants.COMBUS.COULD_NOT_PUBLISH, jmsex);
    }
    lock.lock();
    try {
        long start = System.currentTimeMillis();
        boolean done = false;
        int seq = 0;
        while (!done) {
            Collection<TextMessage> messageSet = correlationIdToMessage.remove(correlationId);
            while (messageSet == null) {
                if (timeout <= 0) {
                    try {
                        newMessage.await(2, TimeUnit.SECONDS);
                    } catch (InterruptedException ie) {
                        throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                    }
                    if (closed || closing) {
                        throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                    }
                    messageSet = correlationIdToMessage.remove(correlationId);
                } else {
                    try {
                        newMessage.await(timeout, TimeUnit.MILLISECONDS);
                    } catch (InterruptedException ie) {
                        throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                    }
                    if (closed || closing) {
                        throw new AnzoException(ExceptionConstants.COMBUS.INTERRUPTED, correlationId);
                    }
                    messageSet = correlationIdToMessage.remove(correlationId);
                    if (!connected) {
                        log.error(LogUtils.COMBUS_MARKER, Messages.formatString(
                                ExceptionConstants.COMBUS.ERROR_PROCESSING_MESSGE, "connection closed"));
                        throw new AnzoException(ExceptionConstants.COMBUS.JMS_NOT_CONNECTED, correlationId);
                    }
                    if (messageSet == null
                            && ((timeout > -1) && ((System.currentTimeMillis() - start) > timeout))) {
                        throw new AnzoException(ExceptionConstants.COMBUS.NO_SERVER_RESPONSE, correlationId);
                    }
                }

            }
            try {
                for (TextMessage message : messageSet) {
                    if (log.isTraceEnabled()) {
                        log.trace(LogUtils.COMBUS_MARKER,
                                MessageUtils.prettyPrint(message, "Recieved Response:"));
                    }
                    if (message.propertyExists("done")) {
                        done = message.getBooleanProperty("done");
                    } else {
                        done = true;
                    }
                    if (message.propertyExists("sequence")) {
                        int sequence = message.getIntProperty("sequence");
                        if (sequence != seq) {
                            throw new AnzoException(ExceptionConstants.COMBUS.NO_SERVER_RESPONSE,
                                    correlationId);
                        } else {
                            seq++;
                        }
                    }

                    int totalSize = 0;
                    if (message.propertyExists(SerializationConstants.totalSolutions)) {
                        totalSize = message.getIntProperty(SerializationConstants.totalSolutions);
                    }
                    if (message.getBooleanProperty(SerializationConstants.operationFailed)) {
                        long errorCodes = message.propertyExists(SerializationConstants.errorTags)
                                ? message.getLongProperty(SerializationConstants.errorCode)
                                : ExceptionConstants.COMBUS.JMS_SERVICE_EXCEPTION;

                        // if available, use enumerated args, since these can be reconstruct an AnzoException correctly.
                        List<String> args = new ArrayList<String>();
                        for (int i = 0; true; i++) {
                            String errorArg = message
                                    .getStringProperty(SerializationConstants.errorMessageArg + i);
                            if (errorArg == null) {
                                break;
                            }
                            args.add(errorArg);
                        }

                        // NOTE: This doesn't really make any sense, but it was here before and it's better to be too verbose than not verbose enough
                        // when it comes to error messages, so it stays.  For now at least. -jpbetz
                        if (args.isEmpty()) {
                            args.add(message.getText());
                        }
                        throw new AnzoException(errorCodes, args.toArray(new String[0]));
                    } else {
                        messageHandler.handleMessage(message, seq, done, totalSize);
                    }
                }
            } catch (JMSException jmsex) {
                log.debug(LogUtils.COMBUS_MARKER, Messages.formatString(
                        ExceptionConstants.COMBUS.ERROR_PROCESSING_MESSGE, "request multiple response"), jmsex);
            }
        }
    } finally {
        lock.unlock();
    }
}

From source file:org.openanzo.combus.realtime.RealtimeUpdatePublisher.java

private void setMessageProperties(Message message, Map<String, Object> properties) throws JMSException {
    // How can we do this more efficiently?
    for (Map.Entry<String, Object> entry : properties.entrySet()) {
        String name = entry.getKey();
        Object value = entry.getValue();
        if (value instanceof String) {
            message.setStringProperty(name, (String) value);
        } else if (value instanceof Integer) {
            message.setIntProperty(name, ((Integer) value).intValue());
        } else if (value instanceof Long) {
            message.setLongProperty(name, ((Long) value).longValue());
        } else if (value instanceof Float) {
            message.setFloatProperty(name, ((Float) value).floatValue());
        } else if (value instanceof Double) {
            message.setDoubleProperty(name, ((Double) value).doubleValue());
        } else if (value instanceof Short) {
            message.setShortProperty(name, ((Short) value).shortValue());
        } else if (value instanceof Byte) {
            message.setByteProperty(name, ((Byte) value).byteValue());
        } else if (value instanceof Boolean) {
            message.setBooleanProperty(name, ((Boolean) value).booleanValue());
        }//  w ww . j  ava 2  s.  co  m
    }
}

From source file:org.wso2.carbon.apimgt.jms.listener.utils.JMSUtils.java

/**
 * Set transport headers from the axis message context, into the JMS message
 *
 * @param messageConfiguration the adaptor message context
 * @param message              the JMS Message
 * @throws JMSException on exception//www. j  ava  2 s .  c o  m
 */
public static void setTransportHeaders(Map<String, String> messageConfiguration, Message message)
        throws JMSException {

    if (messageConfiguration == null) {
        return;
    }

    for (String name : messageConfiguration.keySet()) {

        if (name.startsWith(JMSConstants.JMSX_PREFIX)
                && !(name.equals(JMSConstants.JMSX_GROUP_ID) || name.equals(JMSConstants.JMSX_GROUP_SEQ))) {
            continue;
        }

        if (JMSConstants.JMS_COORELATION_ID.equals(name)) {
            message.setJMSCorrelationID(messageConfiguration.get(JMSConstants.JMS_COORELATION_ID));
        } else if (JMSConstants.JMS_DELIVERY_MODE.equals(name)) {
            String mode = messageConfiguration.get(JMSConstants.JMS_DELIVERY_MODE);
            try {
                message.setJMSDeliveryMode(Integer.parseInt(mode));
            } catch (NumberFormatException nfe) {
                log.warn("Invalid delivery mode ignored : " + mode, nfe);
            }

        } else if (JMSConstants.JMS_EXPIRATION.equals(name)) {
            message.setJMSExpiration(Long.parseLong(messageConfiguration.get(JMSConstants.JMS_EXPIRATION)));
        } else if (JMSConstants.JMS_MESSAGE_ID.equals(name)) {
            message.setJMSMessageID(messageConfiguration.get(JMSConstants.JMS_MESSAGE_ID));
        } else if (JMSConstants.JMS_PRIORITY.equals(name)) {
            message.setJMSPriority(Integer.parseInt(messageConfiguration.get(JMSConstants.JMS_PRIORITY)));
        } else if (JMSConstants.JMS_TIMESTAMP.equals(name)) {
            message.setJMSTimestamp(Long.parseLong(messageConfiguration.get(JMSConstants.JMS_TIMESTAMP)));
        } else if (JMSConstants.JMS_MESSAGE_TYPE.equals(name)) {
            message.setJMSType(messageConfiguration.get(JMSConstants.JMS_MESSAGE_TYPE));

        } else {

            //TODO currently only string is supported  in messageConfiguration
            Object value = messageConfiguration.get(name);
            if (value instanceof String) {
                message.setStringProperty(name, (String) value);
            } else if (value instanceof Boolean) {
                message.setBooleanProperty(name, (Boolean) value);
            } else if (value instanceof Integer) {
                message.setIntProperty(name, (Integer) value);
            } else if (value instanceof Long) {
                message.setLongProperty(name, (Long) value);
            } else if (value instanceof Double) {
                message.setDoubleProperty(name, (Double) value);
            } else if (value instanceof Float) {
                message.setFloatProperty(name, (Float) value);
            }
        }
    }
}