11-10 Programming JMS for Oracle WebLogic Server
mechanism for UOW messages. One other requirement for UOW in distributed destinations is that all member destinations must have the same value for the UOW
Handling Policy. A configuration that is configured otherwise is invalid.
As a best practice, the use of topics especially distributed topics is discouraged for use as intermediate UOW destinations, as this configuration may possibly lead to
duplicate component messages.
11.4.3 UOW and Store-and-Forward Destinations
The WebLogic Store-and-Forward service supports UOW, with the exception that a store-and-forward SAF imported destination cannot be a terminal destination.
However, SAF obeys the routing rules of UOW messages, just as it does for UOO messages. See
Section 10.5.7, Using Unit-of-Order with WebLogic Store-and-Forward.
11.5 Limitations of UOW Message Groups
This section provides additional general information to consider when using UOW.
■
JMS clients created using WebLogic Server prior to 9.0 cannot create messages that will be processed as part of a UOW.
■
The JMS C JNI client is not able to process UOW messages at a terminal destination, since they are object messages. It can, however, be used as a UOW
producer or on an intermediate destination.
■
UOW is poorly suited for sets of large file transfers. Ideally, your messaging environment is configured for lower max message sizes and to facilitate the
streaming transfer of large chunks of data such as large files from a single producer to a single consumer. UOW doesnt handle this use-case because the
individual messages are accumulated back into one giant message on the server before they are pushed to the consumer, rather than streamed.
12
Using Transactions with WebLogic JMS 12-1
12
Using Transactions with WebLogic JMS
The following sections describe how to use transactions with WebLogic JMS:
■
Section 12.1, Overview of Transactions
■
Section 12.2, Using JMS Transacted Sessions
■
Section 12.3, Using JTA User Transactions
■
Section 12.4, JTA User Transactions Using Message Driven Beans
■
Section 12.5, Example: JMS and EJB in a JTA User Transaction
■
Section 12.6, Using Cross Domain Security
12.1 Overview of Transactions
A transaction enables an application to coordinate a group of messages for production and consumption, treating messages sent or received as an atomic unit.
When an application commits a transaction, all of the messages it received within the transaction are removed from the messaging system and the messages it sent within
the transaction are actually delivered. If the application rolls back the transaction, the messages it received within the transaction are returned to the messaging system and
messages it sent are discarded.
When a topic subscriber rolls back a received message, the message is redelivered to that subscriber. When a queue receiver rolls back a received message, the message is
redelivered to the queue, not the consumer, so that another consumer on that queue may receive the message.
For example, when shopping online, you select items and store them in an online shopping cart. Each ordered item is stored as part of the transaction, but your credit
card is not charged until you confirm the order by checking out. At any time, you can cancel your order and empty your cart, rolling back all orders within the current
transaction.
There are three ways to use transactions with JMS:
■
If you are using only JMS in your transactions, you can create a JMS transacted session.
Note: For more information about the JMS classes described in this
section, access the latest JMS Specification and Javadoc supplied on the Sun Microsystems Java Web site at the following location:
http:java.sun.comproductsjmsdocs.html .
12-2 Programming JMS for Oracle WebLogic Server
■
If you are mixing other operations, such as EJB, with JMS operations, you should use a Java Transaction API JTA user transaction in a non-transacted JMS session.
■
Use message driven beans. The following sections explain how to use a JMS transacted session and JTA user
transaction.
12.2 Using JMS Transacted Sessions