org.jboss.soa.esb.actions.routing
Class JMSRouter

java.lang.Object
  extended by org.jboss.soa.esb.actions.AbstractActionLifecycle
      extended by org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
          extended by org.jboss.soa.esb.actions.routing.AbstractRouter
              extended by org.jboss.soa.esb.actions.routing.JMSRouter
All Implemented Interfaces:
ActionLifecycle, ActionPipelineProcessor

public class JMSRouter
extends AbstractRouter

JMS Routing Action Processor.

Sample Action Configuration:

 <action class="org.jboss.soa.esb.actions.routing.JMSRouter">
     <property name="jndiName" value="queue/A"/>
 </action>

 Option properties:
     <property name="unwrap" value="false"/>
     <property name="jndi-context-factory" value="org.jnp.interfaces.NamingContextFactory"/>
     <property name="jndi-URL" value="127.0.0.1:1099"/>
     <property name="jndi-pkg-prefix" value="org.jboss.naming:org.jnp.interfaces"/>
     <property name="connection-factory" value="ConnectionFactory"/>
     <property name="persistent" value="true"/>
     <property name="priority" value="javax.jms.Message.DEFAULT_PRIORITY"/>
     <property name="time-to-live" value="javax.jms.Message.DEFAULT_TIME_TO_LIVE"/>
     <property name="security-principal" value="username"/>
     <property name="security-credential" value="pasword"/>
     <property name="message-prop->prop-name<="> value="prop-value<" />
 
Description of configuration attribues:

Since:
Version 4.0
Author:
tom.fennelly@jboss.com, daniel.bevenius@redhat.com

Field Summary
static java.lang.String PERSISTENT_ATTR
          Constant used in configuration
static java.lang.String PRIORITY_ATTR
          Constant used in configuration
static java.lang.String SECURITY_CREDITIAL
          Security credential used when creating the JMS connection
static java.lang.String SECURITY_PRINCIPAL
          Security principal used when creating the JMS connection
static java.lang.String TIME_TO_LIVE_ATTR
          Constant used in configuration
 
Fields inherited from class org.jboss.soa.esb.actions.routing.AbstractRouter
payloadProxy, unwrap
 
Fields inherited from interface org.jboss.soa.esb.actions.ActionPipelineProcessor
PROCESS_EXCEPTION_METHOD, PROCESS_METHOD, PROCESS_SUCCESS_METHOD
 
Constructor Summary
JMSRouter(ConfigTree propertiesTree)
          Sole public constructor.
 
Method Summary
protected  javax.jms.Message createJMSMessageWithObjectType(java.lang.Object objectFromBody)
           
protected  javax.jms.Message createObjectMessage(java.lang.Object message)
           
protected  void createQueueSetup(java.lang.String queueName)
           
protected  void createQueueSetup(java.lang.String queueName, java.lang.String jndiContextFactory, java.lang.String jndiUrl, java.lang.String jndiPkgPrefix, java.lang.String connectionFactory, java.lang.String securityPrincipal, java.lang.String securityCredential)
           
protected  void finalize()
           
 java.lang.String getConnectionFactory()
           
 java.lang.String getContextFactoryName()
           
 java.io.Serializable getErrorNotification(Message message)
           
 java.lang.String getJndiPkgPrefix()
           
 java.lang.String getJndiURL()
           
 java.io.Serializable getOkNotification(Message message)
           
 int getPriority()
          The priority used when sending messages.
 long getTimeToLive()
          The time-to-live used when sending messages.
 boolean isDeliveryModePersistent()
          The delivery mode in use.
 Message process(Message message)
          Will simply pass the message to the route method unmodified.
 void route(java.lang.Object message)
          Route the message or message payload.
protected  void send(javax.jms.Message jmsMessage)
           
protected  void setJMSProperties(Message fromESBMessage, javax.jms.Message toJMSMessage)
          This method will set appropriate JMSProperties on the outgoing JMS Message instance.
protected  void setJMSReplyTo(javax.jms.Message jmsMessage, Message esbMessage)
           
 
Methods inherited from class org.jboss.soa.esb.actions.routing.AbstractRouter
getPayloadProxy
 
Methods inherited from class org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
processException, processSuccess
 
Methods inherited from class org.jboss.soa.esb.actions.AbstractActionLifecycle
destroy, initialise
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.soa.esb.actions.ActionLifecycle
destroy, initialise
 

Field Detail

PERSISTENT_ATTR

public static final java.lang.String PERSISTENT_ATTR
Constant used in configuration

See Also:
Constant Field Values

PRIORITY_ATTR

public static final java.lang.String PRIORITY_ATTR
Constant used in configuration

See Also:
Constant Field Values

TIME_TO_LIVE_ATTR

public static final java.lang.String TIME_TO_LIVE_ATTR
Constant used in configuration

See Also:
Constant Field Values

SECURITY_PRINCIPAL

public static final java.lang.String SECURITY_PRINCIPAL
Security principal used when creating the JMS connection

See Also:
Constant Field Values

SECURITY_CREDITIAL

public static final java.lang.String SECURITY_CREDITIAL
Security credential used when creating the JMS connection

See Also:
Constant Field Values
Constructor Detail

JMSRouter

public JMSRouter(ConfigTree propertiesTree)
          throws ConfigurationException,
                 javax.naming.NamingException,
                 javax.jms.JMSException
Sole public constructor.

Parameters:
propertiesTree - Action properties.
Throws:
ConfigurationException - Queue name not configured.
javax.jms.JMSException - Unable to configure JMS destination.
javax.naming.NamingException - Unable to configure JMS destination.
Method Detail

process

public Message process(Message message)
                throws ActionProcessingException
Will simply pass the message to the route method unmodified.

Specified by:
process in interface ActionPipelineProcessor
Overrides:
process in class AbstractRouter
Parameters:
message - The current message being processed.
Returns:
null which will case the action pipeline processing to stop
Throws:
ActionProcessingException - for errors during processing.

route

public void route(java.lang.Object message)
           throws ActionProcessingException
Description copied from class: AbstractRouter
Route the message or message payload.

If the message is to be unwrapped, it will have been unwrapped at this stage.

Specified by:
route in class AbstractRouter
Parameters:
message - The object to route.
Throws:
ActionProcessingException - Exception during routing operation.

createJMSMessageWithObjectType

protected javax.jms.Message createJMSMessageWithObjectType(java.lang.Object objectFromBody)
                                                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException

send

protected void send(javax.jms.Message jmsMessage)
             throws javax.jms.JMSException
Throws:
javax.jms.JMSException

setJMSProperties

protected void setJMSProperties(Message fromESBMessage,
                                javax.jms.Message toJMSMessage)
                         throws javax.jms.JMSException
This method will set appropriate JMSProperties on the outgoing JMS Message instance.

Sublclasses can either override this method to add a different behaviour, or they can set the strategy by calling #setJmsPropertiesStrategy(JMSPropertiesSetter).

See JMSPropertiesSetter for more info.

Throws:
javax.jms.JMSException

createObjectMessage

protected javax.jms.Message createObjectMessage(java.lang.Object message)
                                         throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getOkNotification

public java.io.Serializable getOkNotification(Message message)

getErrorNotification

public java.io.Serializable getErrorNotification(Message message)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

createQueueSetup

protected void createQueueSetup(java.lang.String queueName)
                         throws ConfigurationException
Throws:
ConfigurationException

createQueueSetup

protected void createQueueSetup(java.lang.String queueName,
                                java.lang.String jndiContextFactory,
                                java.lang.String jndiUrl,
                                java.lang.String jndiPkgPrefix,
                                java.lang.String connectionFactory,
                                java.lang.String securityPrincipal,
                                java.lang.String securityCredential)
                         throws ConfigurationException
Throws:
ConfigurationException

setJMSReplyTo

protected void setJMSReplyTo(javax.jms.Message jmsMessage,
                             Message esbMessage)
                      throws java.net.URISyntaxException,
                             javax.jms.JMSException,
                             javax.naming.NamingException,
                             org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException
Throws:
java.net.URISyntaxException
javax.jms.JMSException
javax.naming.NamingException
org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException

isDeliveryModePersistent

public boolean isDeliveryModePersistent()
The delivery mode in use.

Returns:
true if the delivery mode is DeliveryMode.PERSISTENT

getPriority

public int getPriority()
The priority used when sending messages.

Returns:
int the priorty

getTimeToLive

public long getTimeToLive()
The time-to-live used when sending messages.

Returns:
int the time-to-live for messages

getContextFactoryName

public java.lang.String getContextFactoryName()

getJndiURL

public java.lang.String getJndiURL()

getJndiPkgPrefix

public java.lang.String getJndiPkgPrefix()

getConnectionFactory

public java.lang.String getConnectionFactory()