org.apache.camel.component.sjms.jms
Class JmsMessageHelper

java.lang.Object
  extended by org.apache.camel.component.sjms.jms.JmsMessageHelper

public final class JmsMessageHelper
extends Object

Utility class for Message.


Field Summary
static String JMS_CORRELATION_ID
          Set by the publishing Client
static String JMS_DELIVERY_MODE
          Set on the send or publish event
static String JMS_DESTINATION
          Set on the send or publish event
static String JMS_EXPIRATION
          Set on the send or publish event
static String JMS_MESSAGE_ID
          Set on the send or publish event
static String JMS_PRIORITY
          Set on the send or publish event
static String JMS_REDELIVERED
          A redelivery flag set by the JMS provider
static String JMS_REPLY_TO
          The JMS Reply To Destination set by the publishing Client
static String JMS_TIMESTAMP
          Set on the send or publish event
static String JMS_TYPE
          Set by the publishing Client
 
Method Summary
static javax.jms.Message createMessage(javax.jms.Session session, Object payload, Map<String,Object> messageHeaders, KeyFormatStrategy keyFormatStrategy)
           
static JmsMessageType discoverJmsMessageType(javax.jms.Message message)
           
static JmsMessageType discoverMessgeTypeFromPayload(Object payload)
           
static void setCorrelationId(javax.jms.Message message, String correlationId)
          Sets the correlation id on the JMS message.
static void setJMSDeliveryMode(javax.jms.Message message, Object deliveryMode)
          Sets the JMSDeliveryMode on the message.
static javax.jms.Message setJmsMessageHeaders(javax.jms.Message jmsMessage, Map<String,Object> messageHeaders, KeyFormatStrategy keyFormatStrategy)
          Adds or updates the Message headers.
static void setMessageType(javax.jms.Message message, String type)
          Sets the correlation id on the JMS message.
static void setProperty(javax.jms.Message jmsMessage, String name, Object value)
          Sets the property on the given JMS message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JMS_CORRELATION_ID

public static final String JMS_CORRELATION_ID
Set by the publishing Client

See Also:
Constant Field Values

JMS_DELIVERY_MODE

public static final String JMS_DELIVERY_MODE
Set on the send or publish event

See Also:
Constant Field Values

JMS_DESTINATION

public static final String JMS_DESTINATION
Set on the send or publish event

See Also:
Constant Field Values

JMS_EXPIRATION

public static final String JMS_EXPIRATION
Set on the send or publish event

See Also:
Constant Field Values

JMS_MESSAGE_ID

public static final String JMS_MESSAGE_ID
Set on the send or publish event

See Also:
Constant Field Values

JMS_PRIORITY

public static final String JMS_PRIORITY
Set on the send or publish event

See Also:
Constant Field Values

JMS_REDELIVERED

public static final String JMS_REDELIVERED
A redelivery flag set by the JMS provider

See Also:
Constant Field Values

JMS_REPLY_TO

public static final String JMS_REPLY_TO
The JMS Reply To Destination set by the publishing Client

See Also:
Constant Field Values

JMS_TIMESTAMP

public static final String JMS_TIMESTAMP
Set on the send or publish event

See Also:
Constant Field Values

JMS_TYPE

public static final String JMS_TYPE
Set by the publishing Client

See Also:
Constant Field Values
Method Detail

createMessage

public static javax.jms.Message createMessage(javax.jms.Session session,
                                              Object payload,
                                              Map<String,Object> messageHeaders,
                                              KeyFormatStrategy keyFormatStrategy)
                                       throws Exception
Throws:
Exception

setJmsMessageHeaders

public static javax.jms.Message setJmsMessageHeaders(javax.jms.Message jmsMessage,
                                                     Map<String,Object> messageHeaders,
                                                     KeyFormatStrategy keyFormatStrategy)
                                              throws IllegalHeaderException
Adds or updates the Message headers. Header names and values are checked for JMS 1.1 compliance.

Parameters:
jmsMessage - the Message to add or update the headers on
messageHeaders - a Map of String/Object pairs
keyFormatStrategy - the a KeyFormatStrategy to used to format keys in a JMS 1.1 compliant manner. If null the DefaultJmsKeyFormatStrategy will be used.
Returns:
Message
Throws:
Exception - a
IllegalHeaderException

setJMSDeliveryMode

public static void setJMSDeliveryMode(javax.jms.Message message,
                                      Object deliveryMode)
                               throws javax.jms.JMSException
Sets the JMSDeliveryMode on the message.

Parameters:
exchange - the exchange
message - the message
deliveryMode - the delivery mode, either as a String or integer
Throws:
javax.jms.JMSException - is thrown if error setting the delivery mode

setMessageType

public static void setMessageType(javax.jms.Message message,
                                  String type)
Sets the correlation id on the JMS message.

Will ignore exception thrown

Parameters:
message - the JMS message
type - the correlation id

setCorrelationId

public static void setCorrelationId(javax.jms.Message message,
                                    String correlationId)
Sets the correlation id on the JMS message.

Will ignore exception thrown

Parameters:
message - the JMS message
correlationId - the correlation id

setProperty

public static void setProperty(javax.jms.Message jmsMessage,
                               String name,
                               Object value)
                        throws javax.jms.JMSException
Sets the property on the given JMS message.

Parameters:
jmsMessage - the JMS message
name - name of the property to set
value - the value
Throws:
javax.jms.JMSException - can be thrown

discoverMessgeTypeFromPayload

public static JmsMessageType discoverMessgeTypeFromPayload(Object payload)

discoverJmsMessageType

public static JmsMessageType discoverJmsMessageType(javax.jms.Message message)


Apache Camel