Example UOW Producer Code UOW Exceptions
11.3.1.1 Example UOW Producer Code
The following sample client code sample sets the UOW properties defined in Table 11–1 . Example 11–1 Sample UOW Producer Message Properties for int i=1; i=100; i++ { sendMsg.setStringPropertyJMS_BEA_UnitOfWork,joule; sendMsg.setIntPropertyJMS_BEA_UnitOfWorkSequenceNumber,i; if i == 100 { System.out.printlnset the end of message flag for message + i; sendMsg.setBooleanPropertyJMS_BEA_IsUnitOfWorkEnd,true; } qSender.sendsendMsg, DeliveryMode.PERSISTENT,7,0; } Table 11–2 Unit-of-Work Properties Type Description JMS_BEA_UnitOfWork A string property that is set by the standard JMS mechanism for setting properties. For example: message.setStringPropertyJMS_BEA_UnitOfWork, MyUnitOfWorkName To avoid naming conflicts, the UOW ID should never be reused. For example, if messages are lost or retransmitted, then they may be perceived as part of a separate UOW. For this reason, Oracle recommends using a Java universally unique identifier UUID. See http:java.sun.comj2se1.5.0docsapijavaut ilUUID.html . JMS_BEA_ UnitOfWorkSequenceNumber An integer property that is set by the standard JMS mechanism for setting properties. For example, message.setIntPropertyJMS_BEA_ UnitOfWorkSequenceNumber, 5 The legal values are integers greater than or equal to 1 JMS_BEA_IsUnitOfWorkEnd A boolean property that is set by the standard JMS mechanism for setting properties. For example: message.setBooleanPropertyJMS_BEA_IsUnitOfWorkEnd, true When this property is true, the message is the last in the unit-of-work. When this property is false or nonexistent, the message is not last in the unit-of-work. 11-6 Programming JMS for Oracle WebLogic Server11.3.1.2 UOW Exceptions
The following exceptions may be thrown to the producer when sending JMS messages to a terminal destination. When a UOW exception is town, the UOW message is not delivered. Except for the last one, they are all in the weblogic.jms.extensions package and are subclasses of JMSException. ■ BadSequenceNumberException – This will occur if a UnitOfWork is set on the message, but SequenceNumber is not or b the SequenceNumber is less than or equal to zero. ■ OutOfSequenceRangeException – This will be thrown if a a message is sent with a SequenceNumber that is higher than the sequence number of the message which has already been marked as the end of the unit or b a message is sent with a sequence number which is lower than a message which has already arrived in the same unit, yet the new message is marked as the end message. ■ DuplicateSequenceNumberException – This will be thrown to the producer if it sends a message with a sequence number which is the same as a previously sent message in the same UOW. ■ JMSException – A JMS exception will be thrown if a message has both the UnitOfOrder property set and the UnitOfWork property set.11.3.2 How to Write a UOW ConsumerProducer For an Intermediate Destination
Parts
» Oracle Fusion Middleware Online Documentation Library
» Document Scope and Audience Guide to this Document
» Related Documentation New and Changed JMS Features In This Release
» Major Components WebLogic JMS Architecture
» Point-to-Point Messaging PublishSubscribe Messaging
» Using the Default Connection Factories
» Connection Understanding the JMS API
» WebLogic JMS Session Guidelines Session Subclasses Non-Transacted Session
» MessageProducer and MessageConsumer Understanding the JMS API
» Message Header Fields Message
» Message Property Fields Message
» ServerSessionPoolFactory ServerSessionPool ServerSession Understanding the JMS API
» ConnectionConsumer Understanding the JMS API
» Message Compression Message Properties and Message Header Fields Message Ordering
» Topics vs. Queues Asynchronous vs. Synchronous Consumers
» Persistent vs. Non-Persistent Messages
» Deferring Acknowledges and Commits Using AUTO_ACK for Non-Durable Subscribers
» Avoid Multi-threading Using the JMSXUserID Property
» Declaring a Wrapped JMS Factory using Deployment Descriptors
» Injecting Resource Dependency into a Class Non-Injected EJB 3.0 Resource Reference Annotations
» Automatically Enlisting Transactions Container-Managed Security
» Connection Testing Java EE Compliance Pooled JMS Connection Objects
» Speeding Up JNDI Lookups by Pooling Session Objects Speeding Up Object Creation Through Caching
» Performance and Tuning Disabling Wrapping and Pooling Simplified Access to Foreign JMS Providers
» ejb-jar.xml weblogic-ejb-jar.xml
» PoolTest.java PoolTestHome.java PoolTestBean.java
» Using compenv Sending a JMS Message In a Java EE Container
» Dependency Injection EJB 3.0 Wrapper Without Injection
» Create a Queue Session Create a Topic Session
» Create QueueSenders and QueueReceivers Create TopicPublishers and TopicSubscribers
» Step 1: Look Up a Connection Factory in JNDI Step 6a: Create the Message Object Message Producers
» Step 6b: Optionally Register an Asynchronous Message Listener
» Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7
» Send a Message Using Queue Sender
» Send a Message Using TopicPublisher
» Create a Message Object Define a Message Setting Message Producer Attributes
» Asynchronous Message Pipeline Receiving Messages Asynchronously
» Use Prefetch Mode to Create a Synchronous Message Pipeline
» Importing Required Packages Acknowledging Received Messages
» Setting a Redelivery Delay Overriding the Redelivery Delay on a Destination
» Defining a Session Exception Listener Closing a Session
» Preconditions for Deleting Destinations What Happens when a Destination is Deleted
» Defining the Persistent Store Setting the Client ID Policy
» Defining the Client ID Creating a Sharable Subscription Policy
» Creating Subscribers for a Durable Subscription Best Practice: Always Close Failed JMS ClientIDs
» Deleting Durable Subscriptions Modifying Durable Subscriptions
» Setting Message Header Fields
» Setting Message Property Fields
» Browsing Header and Property Fields
» Displaying Message Selectors Indexing Topic Subscriber Message Selectors To Optimize Performance
» WebLogic XML APIs Using a String Representation Using a DOM Representation
» Releasing Object Resources Configuring JMS System Resources Using JMSModuleHelper
» Creating a JMS System Resource Deleting a JMS System Resource
» Configuring JMS Servers and Store-and-Forward Agents Best Practices when Using JMSModuleHelper
» Benefits of Using Multicasting Limitations of Using Multicasting Using WebLogic Server Unicast
» Step 2: Set Up the Message Listener Dynamically Configuring Multicasting Configuration Attributes
» Uniform Distributed Destinations Weighted Distributed Destinations
» Queue Forwarding QueueSenders QueueReceivers
» TopicPublishers TopicSubscribers Using Replicated Distributed Topics
» Maximizing Production Stuck Messages
» Message Processing According to the JMS Specification Message Processing with Unit-of-Order
» Message Delivery with Unit-of-Order
» Joe Orders a Book What Happened to Joes Order
» Unit-of-Order and Distributed Topics Unit-of-Order, Topics, and Message Driven Beans
» Basic UOW Terminology Rules For Processing UOW Messages
» Example UOW Producer Code UOW Exceptions
» Limitations of UOW Message Groups Overview of Transactions
» WebLogic Messaging High Availability Features
» Application Design Limitations When using Replicated Distributed Topics Advanced Topic Features
» What is the Subscription Key Configuring a Shared Subscription
» Managing Durable Subscriptions How Sharing a Durable Subscription Works
» Sample Producer Code Re-usable ConnectionFactory Objects
» Re-usable Destination Objects Reconnected Connection Objects
» Reconnected Session Objects Automatic Failover for JMS Producers
» Special Cases for Reconnected Consumers
» Integer int Long long Character char String
» Closing Connections Helper Functions
Show more