The Transaction interface allows operations to be performed against the transaction in the target Transaction object. A Transaction object is created corresponding to each global transaction creation in which one or more resources participate. In FioranoMQ, the resource (javax.transaction.xa.XAResource object) is available which participates in distributed transactions. Refer to JTA specification for more details on XAResource object.
FioranoMQ provides the following admin APIs related to distributed transactions:
- Get All Transactions Returns an enumeration of XIDs with the given status.
- Get Transaction status Returns the status of the transaction specified with the XID.
23.13.1 Get All Transactions
This function returns the enumeration of all the XIDs with a given status. The status of a transaction can be started, ended, suspended or prepared.
Below are the instructions to return all the transactions with a 'given' status running on the FioranoMQ server.
- Look up an admin Connection Factory
- Create an admin connection
- Obtain the admin service from the admin connection
- Retrieve all the transactions with a given status
This section explains how to retrieve the list of transactions that have started :
- Creating the Admin Service
MQ Admin Service retrieves the list of transactions from the FioranoMQ server. The instance of admin service can be obtained from the admin connection.
2. Transaction List
Alist of the transactions, given their status, can be retrieved from the admin service. To retrieve a list of transactions that have started, the code snippet given below is to be used. This returns all transactions currently present in the MQ server started in the given state
3. Retrieve Transactions
Individual transactions or XIDs can be retrieved from a list of transactions using the code below:
This function returns the status of a transaction, which is specified with a XID. The returned status can be started, ended, suspended or prepared.
23.13.2 Get Transaction Status
Below are the instructions to retrieve the status of a given transaction:
- Look up an admin connection factory.
- Create an admin connection.
- Obtain the admin service from the admin Connection.
- Retrieve the status of a given transaction.
This section explains how to obtain the status of a given transaction:
- Creating the Admin Service
MQ Admin Service obtains the status of a given transaction from the FioranoMQ server. The instance of admin service can be retrieved from the admin connection.
- acf = (MQAdminConnectionFactory) ic.lookup ("primaryACF");
- ac = acf.createMQAdminConnection ("admin", "passwd");
- adminService = ac.getMQAdminService();
- Retrieve Transaction Status
The status of a given transaction, specified by XID, can be retrieved using the admin service object.
Possible options for the status byte:
- IFioranoConstants.START - specifies that the transaction is in the started state.
- IFioranoConstants.END - specifies that the transaction is in the ended state.
- IFioranoConstants.SUSPEND - specifies that the transaction suspended state.
- IFioranoConstants.PREPARED - specifies that the transaction is in the prepared