↓ Skip to main content

Beware transaction completion order

·2 mins

I should know better having once worked in the WebSphere Application Server transactions development team but it is easy to assume that JTA maintains consistency throughout the lifetime of a transaction. In reality though, for a distributed transaction it is impossible to ensure that all resource managers commit at precisely the same moment. The result is that, between the first and last commit, the state of the different resources is inconsistent. This can be a particular problem if one of the changes taking place under the transaction is used to trigger further processing.

Take, for example, the Claim Check pattern where, to reduce the quanitity of data transmitted asynchronously between two processes, the bulk of the data is written to a database and just a reference to the database entry passed in a message. The write to the database and the sending of the message are typically co-ordinated in a transaction to obtain atomicity. Now, if the resource manager responsible for the message is told to commit first, it is possible that someone will attempt to receive the message and de-reference the data before the database has been told to commit.

To resolve this issue, as of fixpack 9 of WebSphere Application Server Version 6.0.2, it is possible to set a custom JVM property to determine that the messaging resource manager should be told to commit last. In Version 6.1, the custom property is no longer required as this has become the default behaviour. In general though, the lesson is that you should not rely on the order in which the transaction manager will drive completion across multiple resource managers.

Related

Supported J2SE JMS client

I’ve previously mentioned the “Client for JMS on J2SE with IBM WebSphere Application Server” on alphaWorks which enables Java clients running in a non-J2EE environment to access destinations on a service integration bus defined in a WebSphere Application Server (or Process Server, ESB or XD) cell. This client has now graduated to a fully supported version. There is now a small install process to take you through the license agreement but you still end up with a JAR file that weighs in at only 2MB. If you also need to suport retrieval of JMS resources from JNDI then that adds around another 0.5MB.

Service Integration Bus Explorer

·1 min
The browser based WebSphere Application Server (WAS) administration console is not an ideal interface for displaying runtime status. In addition, when working with the Service Integration Bus in WAS V6, the resources associated with a bus are spread over numerous panels. For a while now, those of use in IBM have had the pleasure of using an SWT application written by a colleague in development (Gareth Matthews) that provides a single viewpoint of the bus resources defined across multiple cells and their current runtime state. The legal niceties having being resolved, this fantastic tool is now available for all on alphaWorks.

J2SE JMS client

·1 min
I’m often asked by customers, both during engagements and more informally, about the support for connecting to the default messaging provider in WebSphere Application Server V6 from a client environment. Until now, the official line has been that either the client container or thin client from the WebSphere Application Client installation should be used. However, installing a 100Mb from a CD isn’t usually what most folks have in mind when talking about a thin client (at which point they start copying files from a server installation). Fortunately, a much more palatable option is now available from alphaWorks in the shape of the “Client for JMS on J2SE with IBM WebSphere Application Server”.