Unit-of-Order and Distributed Topics Unit-of-Order, Topics, and Message Driven Beans

10-10 Programming JMS for Oracle WebLogic Server

10.5.5 Using Unit-of-Order with Topics

Assigning a Unit-of-Order does not prohibit parallel processing of a message by two subscribers on the same topic. Since individual subscribers for a topic have their own destination and message list, similar to a queue with one consumer, messages are processed by all subscribers according to the Unit-of-Order assigned at the time of production.

10.5.5.1 Unit-of-Order and Distributed Topics

The routing of messages between physical topics can affect Unit-of-Order if an application directly sends to a member of a distributed topic. To ensure correct order of processing, the application must ensure the messages are sent via the logical distributed topic that is, the destination is obtained using the JNDI name of the distributed topic. WebLogic Server then ensures messages with the same Unit-of-Order take the same path to the distributed topic member.

10.5.5.2 Unit-of-Order, Topics, and Message Driven Beans

The WebLogic Server message driven bean implementation goes beyond the requirements of the EJB and JMS specifications to provide parallel processing of an incoming message stream for a single topic subscription and JMS session. This parallel processing does not take Unit-of-Order into account, so care is required to ensure that the processing is still ordered correctly. There are two ways to achieve this – either process each message in its own JTA transaction, or disable parallel processing by setting the pool size to one. When using Unit-of-Order with topics and message driven beans, you must either: ■ Section 10.5.5.2.1, Use JTA Transactions or ■ Section 10.5.5.2.2, Set Pools Size to One Start by configuring MDBs to Section 10.5.5.2.1, Use JTA Transactions. In the unlikely event that the transaction overhead is unacceptable, switch to Section 10.5.5.2.2, Set Pools Size to One.

10.5.5.2.1 Use JTA Transactions The simplest approach is to use JTA transactions. It has

a processing overhead, but is usually low as WebLogic Server has a highly optimized transaction engine and the application benefits from parallel processing of messages that have different Units-of-Order. The JTA transaction may be of benefit for some application use cases. For example, where it is necessary to ensure atomic interaction with other operations such as sending JMS messages, or updating a database.

10.5.5.2.2 Set Pools Size to One Setting the pool size to one allows more efficient,

non-transactional messaging to be used, but has a drastic effect on parallelism.

10.5.6 Using Unit-of-Order with JMS Message Management