Contents
 Contents

FioranoMQ can be used to run the distributed transaction in which the Borland Transaction manager is the co-ordinator. Consider a scenario where an enterprise application takes part in a distributed transaction in which it receives a message from a JMS queue and inserts that message in the cloudscape database. The implementation of this scenario can be downloaded from the fiorano_borland.zip link.

23.7.1 Sample Details

Unzip the file sample downloaded from Ufiorano_borland.zipU. This file contains all the necessary files required to run the sample.

  • CreateCloudScapeDB.java - This file creates the database on the cloudscape database.
  • TestXaCloudScapeSampleWithTM.java - This file runs the distributed transaction in which messages received from a queue are inserted into the cloudscape database tables.

23.7.2 Integrate Fiorano with Borland Enterprise server

Integrate the Borland Application server with FioranoMQ using the instructions present in Chapter 29: Application Server Integration.

23.7.3 Configure Classpath

  1. Configure the classpath by adding the following Borland related files to the run-client.bat (run-client.sh on UNIX Systems ) file, which is available in the fmq/bin/ directory of the FioranoMQ installation package. The files asrt.jar, vbjorb.jar, lm.jar, vbsec.jar, xmlrt.jar, jsse.jar, jaas.jar, jcert.jar, jnet.jar, vbejb.jar are available in the library directory of the Borland installation. The sample run-client.bat (run-client.sh) can be downloaded as well.
  2. Modify the FMQ_DIR variable and BORLAND_DIR variable within the script before using it. Add the cloudscape related files to the classpath.

cloudview40.jar, cloudscape.jar.

3. Modify the CLOUDSCAPE_DIR in the downloaded script file.

Database Creation:

  • Create two instances of cloudscape databases using run-client COM.CloudScape.tools.cview
  • Create tables in the database using the sample CreateCloudscapeDB available from the downloaded zip file.

Usage:

<databasepath> represents the path of the cloudscape database.

Run the distributed transaction:

  • Run the distributed transaction using the sample TestXaCloudScapeSample with TM available in the downloaded zip file.

Usage:

Given below is a description of the command line parameters:

  • <host-no> This parameter specifies the machine name or IP address on which the FioranoMQ server is running.
  • <port-no> This parameter specifies the port number of the machine on which the FioranoMQ server is running.
  • <num-of-messages> This parameter specifies the number of messages that should be received from the queue and inserted into the cloudscape database in a distributed transaction.
  • <xaqcf-name> This parameter specifies the name of the XA enabled queue connection factory.
  • <queue-name> This parameter specifies the name of the queue from which messages should start.

Example:

Sample Details

Details of the sample are examined to see how the distributed transaction works with the Borland transaction manager.

  • Transaction Reference

This is the reference to the transaction object. This reference is provided to the application by the transaction co-ordinator. Here, the transaction co-ordinator is the Borland Transaction Manager, which provides the application with a transaction object.

  • Enlisting Transaction

The resources should be enlisted within the transaction to inform the transaction about their participation. Reference to the resources is provided by the resource provider.

  • Begin Transaction

Begin the transaction after enlisting the participating resources. All the work done after starting the transaction is associated with the transaction. An example of work done is the publishing of a message on a queue.

  • Delisting Transaction

After performing the task allocated within the transaction, the resources should be removed from the transaction. Removing the resources inform the transaction indicates that any work performed after this transaction should not be made part of the transaction.

The parameter, XAResource. SUCCESS indicates that the transaction has ended successfully. If an exception occurs while performing a task, the application can remove the resource with XAResource.FAIL.

  • Committing Transaction

Committing a transaction commits the work performed by all the participating resources. Commit is performed by a two-phase commit protocol.

Adaptavist ThemeBuilder EngineAtlassian Confluence