Program guide > Programming with system APIs and plug-ins > Transaction life cycle plug-ins

WebSphereTransactionCallback plug-in

When you use the WebSphereTransactionCallback plug-in, enterprise applications that are running in a WAS environment can manage ObjectGrid transactions.

When you are using an ObjectGrid session within a method that is configured to use container-managed transactions, the enterprise container automatically begins, commits or rolls back the ObjectGrid transaction. When you are using Java™ Transaction API (JTA) UserTransaction objects, the ObjectGrid transaction is managed by the UserTransaction object automatically.

For a detailed discussion of the implementation of this plug-in, see External transaction managers.

The ObjectGrid does not support 2-phase, XA transactions. This plug-in does not enlist the ObjectGrid transaction with the transaction manager. Therefore, if the ObjectGrid fails to commit, any other resources that are managed by the XA transaction do not roll back.

Programmatically plug in the WebSphereTransactionCallback object

You can enable the WebSphereTransactionCallback into the ObjectGrid configuration with programmatic configuration or XML configuration. The following code snippet uses the application to the WebSphereTransactionCallback object and adds it to an ObjectGrid:

ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
ObjectGrid myGrid = objectGridManager.createObjectGrid("myGrid", false);
WebSphereTransactionCallback wsTxCallback= new WebSphereTransactionCallback ();

XML configuration approach to plug in the WebSphereTransactionCallback object

The following XML configuration creates the WebSphereTransactionCallback object and adds it to an ObjectGrid. The following text must be in the myGrid.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi=""
    xsi:schemaLocation=" ../objectGrid.xsd"
<objectGrid name="myGrid">
<bean id="TransactionCallback" className=
    "" />


Parent topic:

Plug-ins for managing transaction life cycle events

Related concepts

Transaction processing overview

Introduction to plug-in slots

External transaction managers