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
Since the JMS message stores persist messages in an ordered manner in a JMS queue, JMS message stores can be used to implement the store-and-forward pattern.
Following is the Add JMS Message Store screen that you will see on the ESB Management Console.
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
- Provider URL (
java.naming.provider.url) - The URL of the JNDI provider.
In addition to specifying the required parameters, you can click Show Additional Parameters and set any of the additional parameters as necessary. For descriptions of each of the additional parameters you can set, see Additional JMS message store parameters.
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 specify values for the following parameters:
- Enable Producer Guaranteed Delivery (
store.producer.guaranteed.delivery.enable) - Whether it is required to enable guaranteed delivery on the producer side. Set this to
Trueif you need to ensure guaranteed delivery.
- Failover Message Store (
store.failover.message.store.name) - The 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 ESB Management Console, see Adding a Message Store.
Additional JMS message store parameters
|JNDI Queue Name (||The message store queue name.||Though this is not a required parameter, we recommend specifying a value for this.|
|Connection factory (||The JNDI name of the connection factory that is used to create jms connections||Though this is not a required parameter, we recommend specifying a value for this.|
|User Name (||The user name to connect to the broker.|
|Password (||The password to connect to the broker.||No|
|JMS API Specification Version (||The JMS API version to be used. Possible values are 1.1 or 1.0.||No. The default value is 1.1.|
|vender.class.loader.enabled||Set 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 WSO2 MB as the message broker:
When using WSO2 MB as the message broker and configuring a Message Processor with
max.delivery.attempts, if WSO2 MB does not get an acknowledgment from ESB, it re-sends the message resulting in duplicate messages being delivered. To avoid this, add the following line in
Following is a sample JMS message store configuration that uses ActiveMQ as the message broker:
When configuring a JMS message store with WSO2 MB or Active MQ you need to copy the required client libraries to the
<ESB_HOME>/repository/component/lib directory. If the relevant client libraries are not copied you will see a
For information on the client libraries you need to copy when configuring a JMS message store with WSO2 MB, see Configure with WSO2 Message Broker.
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"/>
If you are using ActiveMQ 5.12.2 and above, you need to set the following system property on server start up for WSO2 ESB's JMS message store to work as expected.
With ActiveMQ 5.12.2 and above, you need to set the above property because users are enforced to explicitly whitelist packages that can be exchanged using ObjectMessages, and due to this restriction the message processor fails to read messages from ActiveMQ with the following error:
For information on configuring the JMS message store with different message brokers, see Store and Forward Using JMS Message Stores.