Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The JMS message store persists messages in a JMS queue inside a JMS Broker. The JMS message store can be configured by specifying the class as class as org.apache.synapse.message.store.impl.jms.JmsStore. Since the JMS message stores persist messages in a JMS queue in an ordered manner, JMS message stores can be used to implement the store-and-forward pattern.

UI Configuration

Following is the Add JMS Message Store screen that you will see on the WSO2 Enterprise Integrator (WSO2 EI) Management Console.

Image Removed

When you add a JMS message store, it is required to specify values for the following:

  • Name - A unique name for the JMS message store. 
  • Initial Context Factory (java.naming.factory.initial) - The JNDI initial context factory class. This class must implement the java.naming.spi.InitialContextFactory interface.
  • Provider URL (java.naming.provider.url) - The URL of the JNDI provider.

...

Note

Note that WSO2 EI has separate message store implementation for WSO2 MB and RabbitMQ. Therefore, if you are using those JMS brokers as your messages store, see the following topics:

Explained below are the parameters you need to configure for a JMS Message Store. Also, find details of other configurations that are relevant to the JMS Message Store. See the following topics for details:

Table of Contents

JMS Message Store parameters

Tip

Use one of the following links for instructions on how to create a message store artifact for the ESB. Be sure to set the message store type as JMS Message Store, and configure the parameters as explained below.

  1. Using WSO2 EI Tooling.
  2. Using the management console.

Listed below are the required parameters for configuring the JMS Message Store.

Parameter Name

Description

Message Store NameGive a unique name for the JMS message store
Message Store typeSelect JMS Message Store from the list of options.
Initial Context FactoryThe URL of the JNDI provider.
Provider URLThe password to connect to the broker.

If you need to ensure guaranteed delivery when you store incoming messages to a JMS message store, and later deliver them to a particular backend, click Show Guaranteed Delivery Parameters and of your messages, specify values for the following parameters:

Parameter Name

Description

Enable Producer Guaranteed

...

DeliveryThis flag specifies whether guaranteed delivery is enabled on the producer side. The value is set to False, by default.
Failover Message

...

StoreThe message store to which the store mediator should send messages when the original message store fails.

For instructions on adding a required type of message store via the EI Management Console, see Adding a Message Store.

...

If required, you can configure the optional parameters listed below.

Parameter Name

Value

Required

JNDI Queue Name (store.jms.destination)The message store queue name.
Though this is not a required parameter, we recommend specifying a value for this.
Connection factory (store.jms.connection.factory)The JNDI name of the connection factory that is used to create
jms
JMS connections
. Though this is not a required parameter, we recommend specifying a value for this.
User Name (store.jms.usernameThe
user name
username to connect to the broker.

No

This value is not required.
Password (store.jms.passwordThe password to connect to the broker.
No
This value is not required
JMS API Specification Version (store.jms.JMSSpecVersion)The JMS API version to be used. Possible values are 1.1 or 1.0.
No. The default
By default, the value is set to 1.1.
vender.class.loader.enabledSet to false when using IBM MQ, which requires skipping the external class loader.
No, except when using IBM MQ

Following is a sample JMS message store configuration that uses the Message Broker profile of WSO2 EI as the message broker:

Code Block
languagexml
<messageStore name="JMSMS" class="org.apache.synapse.message.store.impl.jms.JmsStore" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
   <parameter name="java.naming.provider.url">repository/conf/jndi.properties</parameter>
   <parameter name="store.jms.destination">ordersQueue</parameter>
   <parameter name="store.jms.connection.factory">queue</parameter>
   <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
</messageStore>

...

Individual message priorities can be set using the following property on the provider. For example, the value can be 0-9 for ActiveMQ.

Code Block
<property name="JMS_PRIORITY" value="9" scope="axis2"/>

Following is a sample JMS message store configuration that uses ActiveMQ as the message broker:

Code Block
languagexml
<messageStore name="JMSMS" class="org.apache.synapse.message.store.impl.jms.JmsStore" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
   <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
   <parameter name="store.jms.destination">ordersQueue</parameter>
   <parameter name="store.jms.connection.factory">queue<>QueueConnectionFactory</parameter>
   <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
</messageStore>
Info
titleNote

When you configure a JMS message store with the Message Broker profile or ActiveMQ, you need to copy the required client libraries to the <EI_HOME>/lib directory. If the relevant client libraries are not copied, you will see a java.lang.ClassNotFoundException

For information on the client libraries you need to copy when configuring a JMS message store with the Message Broker profile, see Configure with the Message Broker profile.

For information on the client libraries you need to copy when configuring a JMS message store with ActiveMQ, see Configure with ActiveMQ.

Individual message priorities can be set using the following property on the provider. For example, the value can be 0-9 for ActiveMQ.

<property name="JMS_PRIORITY" value="9" scope="axis2"/>

...

titleNote

...

Other configurations

If you are using ActiveMQ 5.12.2 and above, you need to set the following system property on server

...

startup for JMS message store to work as expected.

-Dorg.apache.activemq.SERIALIZABLE_PACKAGES="*"
With ActiveMQ 5.12.2 and above, you need to set the above property
Code Block
languagebash

This is required because users are enforced to explicitly whitelist packages that can be exchanged using ObjectMessages

...

. Due to this restriction, the message processor fails to read messages from ActiveMQ with the following error:

Code Block
languagebash
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.
Info
titleNote

When you configure a JMS message store with the ActiveMQ, you need to copy the required client libraries to the <EI_HOME>/lib directory. If the relevant client libraries are not copied, you will see a java.lang.ClassNotFoundException

For information on

...

the client libraries that you need to copy when configuring a JMS message store with

...

ActiveMQ, see Configure with ActiveMQ.

Related topics

...

hiddentrue

...

  • .