JMS Transport
The Java Message Service (JMS) transport implementation also comes from the WS-Commons Transports project. All the relevant classes are packed into the axis2-transport-jms-<version>.jar
and the following classes act as the transport receiver and the sender respectively.
org.apache.axis2.transport.jms.JMSListener
org.apache.axis2.transport.jms.JMSSender
JMS messages can be easily configured using the WSO2 Message Broker. This message brokering system is based on JMS specifications and is thereby capable of communicating with any JMS client. WSO2 MB can be effectively used with WSO2 DSS in order to configure JMS queues and topics and to manage message routing, message stores and message processors.
The JMS transport implementation requires an active JMS server instance to be able to receive and send messages. We recommend using Apache ActiveMQ JMS server, but other implementations such as Apache Qpid and Tibco are also supported. You also need to put the client JARs for your JMS server in the product's classpath.
- Download Apache ActiveMQ (version 5.2.0 or later is recommended).
- Extract the downloaded archive and find the required dependencies in the
$ACTIVEMQ_HOME/lib
directory. The JARs that should be added to the product's classpath from Apache ActiveMQ are as follows:ActiveMQ 5.8.0 and above
- activemq-broker-5.8.0.jar
- activemq-client-5.8.0.jar
- geronimo-jms_1.1_spec-1.1.1.jar
- geronimo-j2ee-management_1.1_spec-1.0.1.jar
- hawtbuf-1.9.jar
Earlier version of ActiveMQactivemq-core-5.5.1.jar
geronimo-j2ee-management_1.0_spec-1.0.jar
geronimo-jms_1.1_spec-1.1.1.jar
- Copy these JAR files over to
<PRODUCT_HOME>/repository/components/lib
directory for the product to be able to pick them up at runtime. Now you need to set up the transport listeners and senders in DSS. Configuration parameters for the JMS receiver and sender are XML fragments that represent JMS connection factories.
To enable the JMS transport listener, un-comment the following listener configuration related to ActiveMQ in the
<DSS_HOME>/repository/conf/axis2/axis2.xml
file.<!--<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory"> <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter> </parameter> <parameter name="myQueueConnectionFactory"> <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter> </parameter> <parameter name="default"> <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter> </parameter> </transportReceiver>-->
To enable the JMS transport sender, un-comment the following configuration in the
<DSS
_HOME>/repository/conf/axis2/axis2_client.xml
file.<!--<transportSender name="jms"--> <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
This is a bare minimal JMS connection factory configuration which consists of four connection factory parameters. JMS connection factory parameters are described in detail below.
JMS Connection Factory Parameters
In transport parameter tables, literals displayed in italic mode under the "Possible Values" column should be considered as fixed literal constant values. Those values can be directly put in transport configurations.
Parameter Name | Description | Required | Possible Values | Default Value |
---|---|---|---|---|
java.naming.factory.initial | JNDI initial context factory class. The class must implement the | Yes | A valid class name |
|
java.naming.provider.url | URL of the JNDI provider. | Yes | A valid URL |
|
java.naming.security.principal | JNDI Username. | No |
|
|
java.naming.security.credentials | JNDI password. | No |
|
|
transport.Transactionality | Desired mode of transactionality. | No | none, local, jta | none |
transport.UserTxnJNDIName | JNDI name to be used to require user transaction. | No |
| |
transport.CacheUserTxn | Whether caching for user transactions should be enabled or not. | No | true, false | true |
transport.jms.SessionTransacted | Whether the JMS session should be transacted or not. | No | true, false | true if transactionality is 'local' |
transport.jms.SessionAcknowledgement | JMS session acknowledgment mode. | No | AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED | AUTO_ACKNOWLEDGE |
transport.jms.ConnectionFactoryJNDIName | The JNDI name of the connection factory. | Yes |
|
|
transport.jms.ConnectionFactoryType | Type of the connection factory. | No | queue, topic | queue |
transport.jms.JMSSpecVersion | JMS API version. | No | 1.1, 1.0.2b | 1.1 |
transport.jms.UserName | The JMS connection username. | No |
|
|
transport.jms.Password | The JMS connection password. | No |
|
|
transport.jms.Destination | The JNDI name of the destination. | No |
| Defaults to service name |
transport.jms.DestinationType | Type of the destination. | No | queue, topic | queue |
transport.jms.DefaultReplyDestination | JNDI name of the default reply destination. | No |
|
|
transport.jms.DefaultReplyDestinationType | Type of the reply destination. | No | queue, topic | Defaults to the type of the destination |
transport.jms.MessageSelector | Message selector implementation. | No |
|
|
transport.jms.SubscriptionDurable | Whether the connection factory is subscription durable or not. | No | true, false | false |
transport.jms.DurableSubscriberClientID | The ClientId parameter when using durable subscriptions | Yes if subscription durable is turned on | true, false | |
transport.jms.DurableSubscriberName | Name of the durable subscriber. | Yes if subscription durable is turned on |
|
|
transport.jms.PubSubNoLocal | Whether the messages should be published by the same connection they were received. | No | true, false | false |
transport.jms.CacheLevel | JMS resource cache level. | No | none, connection, session, consumer, producer, auto | auto |
transport.jms.ReceiveTimeout | Time to wait for a JMS message during polling. Set this parameter value to a negative integer to wait indefinitely. Set to zero to prevent waiting. | No | Number of milliseconds to wait | 1000 ms |
transport.jms.ConcurrentConsumers | Number of concurrent threads to be started to consume messages when polling. | No | Any positive integer - For topics this must be always 1 | 1 |
transport.jms.MaxConcurrentConsumers | Maximum number of concurrent threads to use during polling. | No | Any positive integer - For topics this must be always 1 | 1 |
transport.jms.IdleTaskLimit | The number of idle runs per thread before it dies out. | No | Any positive integer | 10 |
transport.jms.MaxMessagesPerTask | The maximum number of successful message receipts per thread. | No | Any positive integer - Use -1 to indicate infinity | -1 |
transport.jms.InitialReconnectDuration | Initial reconnection attempts duration in milliseconds. | No | Any positive integer | 10000 ms |
transport.jms.ReconnectProgressFactor | Factor by which the reconnection duration will be increased. | No | Any positive integer | 2 |
transport.jms.MaxReconnectDuration | Maximum reconnection duration in milliseconds. | No |
| 3600000 ms (1 hr) |
JMS transport implementation has some parameters that should be configured at service level, in other words in service XML files of individual services.
Service Level JMS Configuration Parameters
Parameter Name | Description | Requried | Possible Values | Default Value |
---|---|---|---|---|
transport.jms.ConnectionFactory | Name of the JMS connection factory the service should use. | No | A name of an already defined connection factory | default |
transport.jms.PublishEPR | JMS EPR to be published in the WSDL. | No | A JMS EPR |
|
You can find more information on JMS in WSO2 ESB documentation: Java Message Service (JMS) Support.