• Indirect Context Management. With indirect context management, an application uses the Current object provided by the Transaction Service to associate the transaction context with the application thread of control and manage it.
• Direct Context Management. In direct context management, an application manipulates the Control and other objects associated with the transaction.If you use direct context management, or a mixture of both context management modes, you must ensure transactional integrity for your application. Once you use direct context management, the VisiTransact Transaction Service has lost the ability to check transaction completeness. See “How does the VisiTransact Transaction Service ensure checked behavior?” for more information about checked behavior.
• Implicit propagation. With implicit propagation, requests are implicitly associated with the application's transaction—meaning they share the application's transaction context. The transaction context is transmitted implicitly to the participating objects by the VisiTransact Transaction Service, without direct intervention by the transaction originator. An object that supports implicit propagation would not typically expect to receive any Transaction Service object as an explicit parameter.
• Explicit propagation. With explicit propagation, the transaction originator (and potentially participating transactional objects) propagates a transaction context by passing objects defined by the Transaction Service as explicit parameters.VisiTransact-managed transactions fall into this category. With VisiTransact-managed transactions, VisiTransact guarantees checked behavior. For more information about checked behavior, see “How does the VisiTransact Transaction Service ensure checked behavior?”.Indirect context management with implicit propagation is not exactly the same as VisiTransact-managed transactions. VisiTransact-managed transactions specifically dictate the use of Current::begin followed by implicit propagation.See “Creating and propagating VisiTransact-managed transactions” for details on using VisiTransact-managed transactions.The client uses a combination of the Current, Control, and other objects which describe the state of the transaction. A client application that uses the Current object (and therefore, is also automatically using implicit propagation) can use explicit propagation by gaining access to the Control object with the Current::getControl() method. It can use a VisiTransact Transaction Service object as an explicit parameter to a transactional object. This is explicit propagation.The client uses a combination of the Current, Control, and other objects which describe the state of the transaction. A client that accesses the VisiTransact Transaction Service objects directly can use the Current::resume() method to set the implicit transaction context associated with its thread. This allows the client to invoke methods of objects that require implicit propagation of the transaction context.See “Other methods of creating and propagating transactions” for details on managing transactions from your application.If most of your transactions are isolated to, and used within, a single process, you may decide to use an in-process instance of the VisiTransact Transaction Service. However, this means that the requirements for transactions (that is, high availability)—usually handled by a stand-alone instance of the VisiTransact Transaction Service—can only be met if the application process remains running when transactions are in progress. This requirement is especially important if other applications (outside of the process) are using the instance of the VisiTransact Transaction Service that you have embedded within your application process. See “Embedding a VisiTransact Transaction Service instance in your application”.
• You can control the instance of the VisiTransact Transaction Service used by arguments passed to ORB_init() or by how you set the Current interface attributes. The Current attributes will override any arguments passed to ORB_init(). This will only take effect for subsequent transactions using Current::begin().
• See “Discovering an instance of the VisiTransact Transaction service” for an explanation of how to set the -Dvbroker.ots.currentName argument.You can integrate several external transactional systems using other CORBA Transaction Services. Since VisiTransact is fully CORBA 2.6-compliant, it is interoperable with other CORBA 2.6-compliant implementations of the OMG CORBA Transaction Service specification. VisiTransact provides valuable extensions to the CORBAservices specification (useful methods such as begin_with_name(), and other features) that cannot be handled by other transaction service implementations.Another option is to implement your own Resource using the Resource interface. This option requires complex programming because logging and recovery, heuristics, and other necessary coding is not handled for you.
• Mixing various types of transaction approaches. For example, you might have a transaction using explicit propagation and then switch to implicit. See “Changing from explicit propagation to implicit” for more information.
• Integrating multiple systems with your VisiTransact application. For example, you can use databases, transaction processing monitors, and messaging software in your transactional application—and integrate them all with VisiTransact.If the program only uses direct context management with explicit propagation, it can use the stubs and header files generated from the CosTransactions.idl or VISTransactions.idl files.Embedding a VisiTransact Transaction Service instance in a C++ executable entails linking in ots_r.lib (ots_r.so on Solaris) and its_support.lib (its_support.so on Solaris) libraries with your application. Adding these libraries to the link line embeds an instance of the VisiTransact Transaction Service in the application's process.
1 Include visits.h in your C++ application.
2 Initialize the VisiTransact server components with ORB_init(). Invoke VISTransactionService::init() to initialize the VisiTransact Transaction Service instance. This must happen after the ORB_init() invocation. For example:
3 Invoke VISTransactionService::terminate() to shutdown the VisiTransact Transaction Service instance.UNIX:ots_r.soWinNT:ots_r.libots64_r.so and its_support64.so on 64 bit platform. ots_r.a(ots64_r.a) and its_support.a(its_support64.a) on AIX and ots_r.sl(ots64_r.sl) and its_support.sl(its_support64.sl) on HP-UX.// Application main
#include <visits.h> // for VISIts
#include <corba.h>
int main(int argc, char** argv)
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
VISTransactionService::init(argc, argv);
// the main work of the application is now performed
...
VISTransactionService::terminate();
}If you are creating transactions directly from the TransactionFactory rather than using Current, then the client will have to bind to the correct TransactionFactory. Refer to the semantics for binding to any CORBA object to make sure the client binds to the correct object.To compile a C++ source file that will link with its_support.lib or ots_r.lib, you must include the version of CosTransactions_c.hh or VISTransactions_c.hh supplied by VisiTransact, not an IDL client stub header file that you generate from CosTransactions.idl or VISTransactions.idl. (The objects you will link against in the VisiTransact-supplied libraries are valid only against the header files used to build them.) Any application using the Current interface will be linking against these libraries.