Sun Java System Message Queue 4.3 Developer's Guide for C Clients

Working With Distributed Transactions

In accordance with the X/Open distributed transaction model, Message Queue C-API support for distributed transactions relies upon a distributed transaction manager. The distributed transaction manage tracks and manages distributed transactions, coordinating the decision to commit them or roll them back, and coordinating failure recovery. The Message Queue C-API supports the X/Open XA interface, qualifying it as an XA-compliant resource manager. This support allows C-API clients running in a distributed transaction processing environment to participate in distributed transactions.

In particular, two C-API functions support the participation of C-API clients in distributed transactions:

MQGetXAConnection()
MQCreateXASession()

If a C-client application is to be used in the context of a distributed transaction, then it must obtain a connection by using MQGetXAConnection() and create a session for producing and consuming messages by using MQCreateXASession(). The start, commit, and rollback, of any distributed transaction is managed by the distributed transaction manager.

For more information on XA resource managers, see the XA Specification.

Message Queue Resource Manager Information

In accordance with the X/Open XA interface specification, a distributed transaction manager needs the following information regarding the Message Queue XA-compliant resource manager:

The following name/value pairs are supported:

Table 2–12 Message Queue Resource Manager Name/Value Pairs

Name 

Value 

Description 

Default 

address 

host:port

The host:port of the broker's Portmapper service. 

localhost:7676

username 

string 

The username for connecting to the broker 

guest

password 

string 

The username's password 

guest

conntype 

TCP or SSL

The protocol type of the connection to the broker 

TCP

trustedhost 

true/false

Whether the broker host is trusted (only applicable for conntype=SSL)

true

certdbpath 

string 

The full path to the directory that contains NSS certificate and key database files 

not set 

clientid 

string 

Required only for JMS durable subscriptions 

not set 

reconnects 

integer 

The number of re-connection attempts to broker (0 means no reconnect) 

0

Programming Examples

To help you program an application that uses distributed transactions, Message Queue provides programming examples based on the Tuxedo distributed transaction manager. A description of the sample programs and their location is provided in Table 1–5.