4.6.8 Getting a TransactionFactory Object Reference Using INS

As of release 8.0, Oracle Tuxedo CORBA supports the use of the CORBA Transaction Service Interface for beginning transactions. Using the ORB::resolve_initial_references(“FactoryFinder”) function, a client gets an object reference to a FactoryFinder. The client then uses the FactoryFinder to get a reference to a TransactionFactory, that it in turn uses to create (begin) a transaction.

The following code snippet shows an example of how a client application, using INS, gets an object reference to the TransactionFactory object. For a complete code example, see the client application in the University Sample.

// Get the factory finder from the ORB:
CORBA::Object_var v_fact_finder_oref =
orb->resolve_initial_references("FactoryFinder");
// Narrow the factory finder :
Tobj::FactoryFinder_var v_fact_finder_ref =
Tobj::FactoryFinder::_narrow(v_fact_finder_oref.in());
// Get the TransactionFactory from the FactoryFinder
CORBA::Object_var v_txn_fac_oref =
v_fact_finder_ref->find_one_factory_by_id(
"IDL:omg.org/CosTransactions/TransactionFactory:1.0");
// Narrow the TransactionFactory object reference
CosTransactions::TransactionFactory_var v_txn_fac_ref =
CosTransactions::TransactionFactory::_narrow(
v_txn_fac_oref.in());

The sequence of events using the INS bootstrapping mechanism is as follows:

  1. Use ORB::resolve_initial_references to get a FactoryFinder.
  2. Use the FactoryFinder to get a TransactionFactory.
  3. Use the create operation on TransactionFactory to begin a transaction.
  4. From the Control object returned from the create operation, use the get_terminator method to get the transaction terminator interface.
  5. Use the commit or rollback operation on the terminator to end or abort the transaction.

The TransactionFactory returns objects that adhere to the standard CORBA Transaction Service interfaces instead of the Oracle delegated interfaces. This means that a third party ORB can use their ORB’s resolve_initial_references function to get a reference to a TransactionFactory from an Oracle Tuxedo CORBA server and use stubs generated from standard OMG IDL to act on the instances returned.