This section describes how to configure the JMS transport in WSO2 Enterprise Integrator (WSO2 EI) with ActiveMQ. The following topics are covered:
Table of Contents | ||
---|---|---|
|
Setting up WSO2 EI and ActiveMQ
Follow the instructions below to set up and configure.
...
Follow the Installation Guide and set up WSO2 EI.
Info |
---|
Do not start WSO2 EI at this point. ActiveMQ should be up and running before starting WSO2 EI. |
...
ActiveMQ 5.8.0 and above
...
Note |
---|
From the below configurations, do the ones in the axis2.xml file based on the profile you use as follows:
|
Table of Contents | ||
---|---|---|
|
Setting up WSO2 EI and ActiveMQ
Follow the instructions below to set up and configure.
- Download, set up and start Apache ActiveMQ.
Follow the Installation Guide and set up WSO2 EI.
Info Do not start WSO2 EI at this point. ActiveMQ should be up and running before starting WSO2 EI.
Anchor clientLibs clientLibs - Copy the following client libraries from the
<ACTIVEMQ_HOME>/lib
directory to the<
EI_HOME>/lib
directory.ActiveMQ 5.8.0 and above
- activemq-broker-5.8.0.jar
- activemq-client-5.8.0.jar
- activemq-kahadb-store-5.8.0.jar
- geronimo-jms_1.1_spec-1.1.1.jar
- geronimo-j2ee-management_1.1_spec-1.0.1.jar
- geronimo-jta_1.0.1B_spec-1.0.1.jar
- hawtbuf-1.9.jar
- Slf4j-api-1.6.6.jar
- activeio-core-3.1.4.jar (available in
<ACTIVEMQ_HOME>/lib/optional
folder)
Earlier version of ActiveMQ
activemq-core-5.5.1.jar
geronimo-j2ee-management_1.0_spec-1.0.jar
geronimo-jms_1.1_spec-1.1.1.jar
Next, configure JMS transport listeners and senders in WSO2 EI based on your requirement. When you need to listen to a JMS queue you need to configure the JMS transport listener and when you need to send messages to a JMS queue you need to configure the JMS transport sender.
Note When configuring JMS with ActiveMQ, you can append ActiveMQ-specific properties to the value of the
java.naming.provider.url
property. For example, you can set theredeliveryDelay
andinitialRedeliveryDelay
properties when configuring a JMS inbound endpoint as follows:<parameter name="java.naming.provider.url">tcp://localhost:61616?jms.redeliveryPolicy.redeliveryDelay=10000&jms.redeliveryPolicy.initialRedeliveryDelay=10000</parameter>
Start ActiveMQ by navigating to
<ACTIVEMQ_HOME>/bin
folder and executing./activemq console
(on Linux/OSX) oractivemq start
(on Windows).Start WSO2 EI by navigating to
<EI_HOME>/bin
folder and executing./integrator.sh
(on Linux/OSX) orintegrator.bat
(on Windows).Note If you are using ActiveMQ 5.12.2 and above when working with message stores, you need to set the following system property on server start up for WSO2 EI's JMS message store to work as expected.
Code Block -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=“*"
Setting the above property is required because users are enforced to explicitly whitelist packages that can be exchanged using ObjectMessages with ActiveMQ 5.12.2 and above.
Therefore, if the above property is not set, the message processor fails to read messages from ActiveMQ with the following error:Code Block ERROR - JmsConsumer [JMS-C-1] cannot receive message from store. Error:Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class org.apache.synapse.message.store.impl.commons.StorableMessage! This class is not trusted to be serialized as ObjectMessage payload.
Now you have instances of ActiveMQ and WSO2 EI configured, up and running. Next, let's take a look at implementation details of various JMS use cases.
AnchorJMSListener JMSListener
Setting up the JMS listener
JMSListener | |
JMSListener |
To enable the JMS transport listener, un-comment the following listener configuration related to ActiveMQ in <EI_HOME>/conf/axis2/axis2.xml
file.
Code Block | ||
---|---|---|
| ||
<!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)--> <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> </parameter> <parameter name="myQueueConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> </transportReceiver> |
...