IBM MQ Adapter¶
Table of contents
Provides an adapter to use IBM MQ (external site) with the MOM messaging function of Nablarch .
Refer to the official Website and manuals of IBM Corporation for the specifications and construction procedures of IBM MQ.
Module list¶
<dependency>
<groupId>com.nablarch.integration</groupId>
<artifactId>nablarch-wmq-adaptor</artifactId>
</dependency>
Important
The library included with IBM MQ v9.3 is used for testing. When changing the version, test in the project to confirm that there are no problems.
Configuration for using this adapter¶
The adapter is enabled by defining components with the following procedure.
- Add the definition of
nablarch.integration.messaging.wmq.provider.WmqMessagingProvider
to the component configuration file. - Configure
WmqMessagingProvider
configured in1
to Messaging Context Management Handler .
A configuration example is shown below.
<!-- Provider implementation for IBM MQ Adapter- -->
<component name="wmqMessagingProvider"
class="nablarch.integration.messaging.wmq.provider.WmqMessagingProvider">
<!-- See Javadoc for configuration value-->
</component>
<!--
Message context management handler
Configure WmqMessagingProvider defined above in messagingProvider property.
-->
<component class="nablarch.fw.messaging.handler.MessagingContextHandler">
<property name="messagingProvider" ref="wmqMessagingProvider" />
</component>
Use distributed transaction¶
This adapter includes a function to realize distributed transactions using IBM MQ as the transaction manager.
This function is used to prevent omission and duplicate capture when sending and receiving messages to and from external systems.
The procedure for using distributed transaction is shown below.
- Define a data source (class that implements javax.sql.XADataSource ) that supports distributed transactions.
- Define a factory class to generate a database connection to support the distributed transaction.
(Definenablarch.integration.messaging.wmq.xa.WmqXADbConnectionFactoryForXADataSource
.) - Configure the factory class defined in
2
to Database Connection Management Handler . - Define a factory class to generate transaction objects for distributed transactions.
(Definenablarch.integration.messaging.wmq.xa.WmqXATransactionFactory
.) - Configure the factory class defined in
4
to Transaction Control Handler .
A configuration example is shown below.
<!--
Configuration of data source for XA
Configure the XA data source in the JDBC implementation of the database product to be used.
In this example, the configuration is for an Oracle database.
-->
<component name="xaDataSource" class="oracle.jdbc.xa.client.OracleXADataSource">
<!-- Configuration of property is omitted -->
</component>
<!-- Configuration of class to generate XA database connection -->
<component name="xaConnectionFactory"
class="nablarch.integration.messaging.wmq.xa.WmqXADbConnectionFactoryForXADataSource">
<!-- Configure XA data source in xaDataSource property.-->
<property name="xaDataSource" ref="xaDataSource" />
<!-- Properties other than the above are omitted -->
</component>
<!-- Configure DB connection handler for distributed transaction -->
<component class="nablarch.common.handler.DbConnectionManagementHandler">
<!-- Configure the class that generates the database connection for XA configured above in the DB connection factory. -->
<property name="connectionFactory" ref="xaConnectionFactory" />
<!-- Properties other than the above are omitted -->
</component>
<!-- Configuration of class that generates XA transaction control object -->
<component name="xaTransactionFactory"
class="nablarch.integration.messaging.wmq.xa.WmqXATransactionFactory" />
<!-- Configure transaction handler for distributed transaction -->
<component class="nablarch.common.handler.TransactionManagementHandler">
<!-- Configure a class that generates the XA transaction control object
configured above in the transaction factory.
-->
<property name="transactionFactory" ref="xaTransactionFactory" />
<!-- Properties other than the above are omitted -->
</component>
Important
For using distributed transactions, an XA resource manager has to be configured for IBM MQ and authority to the database has to be granted. Refer to the manual of the product to be used for the detailed configuration method and necessary authority.