Problem:
- Product Name: VisiBroker for C
- Product Version: All
- Product Component: VisiTransact - POA Managed Transaction (PMT)
- Platform/OS Version: All
Application programmers can unintentionally and unknowingly set up XA resource programmatically for some purposes (i.e. trying to parse and/or dynamically set the branch qualifiers, XA connection, thread settings) even though the PMT has been enabled. With PMT enabled, the following code will fail:
try
{
CORBA_String_var sDescXML =
_orb->getPropertyManager()-> getString("vbroker.its.xadesc");
CORBA::Object_var ref = _orb->resolve_initial_references("CAM::Assembler");
CAM::Descriptor_var desc = dom2cam::parse_and_convert((const char *) sDescXML, NULL);
if (desc.in() == NULL)
{
cout <>
}
CAM::Assembler_var assembler = CAM::Assembler::_narrow(ref.in());
assembler->assemble(desc);
}
catch(CAM::Assembler::Failure& e)
{
printf("exception at: %s %s %s, %s (section: %s)\\n", e.node->parent()->name(), e.node->name(), e.message.in(), (e.ref.in())? e.ref.in():"", e.section.in());
}
The following exception will be thrown at assembler->assemble(desc);
exception at: Fail to add xa-resource, Duplicate XA resource name (section: )
Resolution:
Applications must not duplicate the implicitly configured and assembled XA resource provided by VisiTransact.
When PMT is enabled, the POALifeCycleInterceptor for PMT implicitly resolves the "CAM::Assember", assembles the XA configuration, creates the XA connection, and hides the complexity of dealing with XA APIs. The PMT resources are global across the process (to protect the DB access).
Extract from VisiBroker 7.0 VisiTransact Developer guide pdf page 161
PMT POA Managed Transaction. A server side transaction and database integration engine. PMT separates and hides all database connection and transaction details from application business logic developers. With PMT, servant implementation business logic does not need to hardcode database connection and transaction logic within its implementation. Database connection and transaction control are independent of business logic, and can be configured and reconfigured during application assembling. With PMT, a given business logic implementation can involve both CIT and SIT. In addition, different operation signatures of a given object can be configured with different transaction attributes.
Extract from VisiBroker 7.0 VisiTransact Developer guide pdf page 163
PMT completely hides database access and transaction details. The server side implementation only needs to write Embedded SQL (or ODBC/CLI) to access an unspecified database, without specific database connection and transaction control statements
The application provider can configure the vbroker.its.xadesc property to point to the XML configuration file. Application provider may link to different XML files with different XA configurations dynamically during start-up.
Author: Mark Dultra
#Security
#VisiBroker
#TransactionService