WebLogic Server 9.0: JMS Enhancements
Pages: 1, 2, 3

JMS Changes for Developers

BEA WebLogic Server 9.0 includes several very interesting new features for developers, including support for JMS 1.1, unit-of-order capabilities, MDB enhancements, and XML-based messaging. The key point to remember with WebLogic Server 9.0 is that you will not have to change your JMS code to make your application run in WebLogic Server 9.0, unless you wish to make use of the new features.

JMS 1.1 support

WebLogic 9 fully supports JMS 1.1. According to Sun Microsystems' documentation, JMS 1.1 brings about the "unification of programming interfaces for the PTP and Pub/Sub" domains. The consequence is that you can create a transacted session, and then receive from a queue and send to a topic within the same transaction. This was not possible in JMS 1.0. The important part is that JMS 1.1 is backward-compatible with JMS 1.0.

Unit-of-order capabilities

Organizations with legacy systems often find that some of their messaging is dependent on sequence. In the "old" days (before J2EE) when there was only a single message consumer, sequence was not a problem, but it becomes a significant challenge when taking MDBs and clusters into consideration. WebLogic Server 9.0 addresses a part of this puzzle by providing unit-of-order capabilities. This feature works best when a group of messages from a single producer must be processed sequentially. 

For example, producer A sends messages X, Y, and Z in a unit-of-order. An MDB picks up message X and processes it. Until the MDB instance commits the transaction, message Y and Z remain on the queue. Only when the MDB commits message X does message Y get processed, and so on.

There are several limitations to unit-of-order:

  • Unit-of-order does not work on an entire queue but only for groups of messages.
  • Unit-of-order is an extension to JMS, which means it will not work in other messaging environments.

One point of interest is that the unit-of-order feature works with distributed queues. All messages in one unit-of-order will be sent to one distributed destination member.

There are two ways to create a unit-of-order, either programmatically or through the WebLogic console. WebLogic supplies a weblogic.jms.extensions.WLMessageProducer class, which implements the javax.jms.MessageProducer interface. BEA has added two methods: getUnitOfOrder() and setUnitOfOrder(). You can use these two methods  to set or get the name of the current unit-of-order. WebLogic administrators can configure a unit-of-order for both sessions (via the connection factories) and destinations. These can be overridden by the setUnitOfOrder() method.

The rules for when messages are delivered in a unit-of-order are complex. The golden rule is that if a message producer is closed, the current message processing is completed, and if a transaction is committed, all messages are sent. Each message acknowledgment mode has its own nuances, and these are well documented.

MDB enhancements

The message-driven beans (MDB) facility in WebLogic Server 9.0 has some significant improvements. Several enhancements stand out, the first three dealing with the problem of looping messages, where the MDB container attempts to deliver the message, the delivery fails, the message is rolled back, the container tries again, and so on ad infinitum. 

  • The first improvement is that administrators can pause MDBs without undeploying the application, as described in the section, "Managing JMS Destinations," above. 
  • Related to the first enhancement is the ability to automatically pause message processing for a configurable amount of time after an MDB throws an exception.
  • The MDB container suppresses logging every exception in its entirety when a message is looping. Instead, the exception will be logged only once, along with the number of times it occurred.
  • A unique client-id can now be created for each instance  of an MDB to aid durable subscribers, instead of each type of MDB as was the case in WebLogic 8.1.
  • The J2EE 1.4 specification states that MDBs may receive messages from JCA 1.5-compliant adapters. You can use this feature by setting the resource-adapter-jndi-name parameter in the weblogic-ejb-jar.xml deployment descriptor.

The full list of MDB enhancements is available on BEA's site.

XML messaging

BEA introduced an XML message type extension in WebLogic Server 8.1, which has been enhanced in WebLogic Server 9.0. The  weblogic.jms.extensions.XMLMessage implements the javax.jms.TextMessage interface, and exposes the setDocument() and getDocument() methods that pass along an org.w3c.dom.Document object. This is a worthy extension, but your mileage may vary if you are interfacing with a non-WebLogic system.


The total number of new features in WebLogic Server 9.0  is enormous and far too lengthy to cover in this article. I have shown you some of the key features, including an improved WebLogic console, MDB enhancements, and the new store-and-forward service. This article should provide a picture of the changes WebLogic Server 9.0 will bring to your applications and J2EE environment.


Special thanks to the following people for taking time to review this article, and for their suggestions about which JMS features should be included: Tom Barnes, Lauren Cooney, Michael Kovacs, Kathiravan Sengodan, Jeff Schieli, and Carolyn Wong.

Additional Reading

Michael Hart is a systems engineer at a high tech firm in Ontario, Canada, where he assists helps design and support a large WebLogic implementation.