If you log in
with your developerWorks ID, you can leave comments and feedback for the development team.
The WebSphereTransactionCallback plugin allows enterprise applications running in a WebSphere Application Server to manage ObjectGrid transactions. When using an ObjectGrid session within a method that is configured to use container-managed transactions, the enterprise container will automatically begin, commit or rollback the ObjectGrid transaction. When using JTA UserTransactions, the ObjectGrid transaction is managed by the UserTransaction automatically.
An implementation of this plugin is described in detail in the ObjectGrid and external transaction interaction topic.
 |
The ObjectGrid does not support 2-phase, XA transactions. This plugin will not enlist the ObjectGrid transaction with the transaction manager and therefore if the ObjectGrid fails to commit, any other resources that are managed by the XA transaction will not roll back. |
Enabling the WebSphereTransactionCallback plugin
Two approaches are available to add the WebSphereTransactionCallback into the ObjectGrid configuration: programmatic configuration and XML configuration.
Programmatically plug in the WebSphereTransactionCallback
The following code snippet creates the WebSphereTransactionCallback and adds it to an ObjectGrid:
ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
ObjectGrid myGrid = objectGridManager.createObjectGrid("myGrid", false);
WebSphereTransactionCallback wsTxCallback= new WebSphereTransactionCallback ();
myGrid.setTransactionCallback(wsTxCallback);
XML configuration approach to plug in the WebSphereTransactionCallback
The WebSphereTransactionCallback can also be configured using XML. The following XML creates a configuration that is equivalent to the described program-created WebSphereTransactionCallback . The following text must be in the myGrid.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="myGrid">
<bean id="TransactionCallback" className="com.ibm.websphere.objectgrid.plugins.builtins.WebSphereTransactionCallback" />
</objectGrid>
</objectGrids>
</objectGridConfig>
Additional information
© Copyright IBM Corporation 2007,2010. All Rights Reserved.