Topics vs. Queues Asynchronous vs. Synchronous Consumers
3.4 Message Ordering
You should use the Message Unit-of-Order feature rather than Ordered Redelivery to guarantee ordered message processing. The advantages of Message Unit-of-Order over Ordered Redelivery are: ■ Ease of configuration. – Does not require a custom connection factory for asynchronous receivers, such as setting MessagingMaximum to 1 when using message-driven beans MDBs. – Simple configuration when using distributed destinations. ■ Preserves message order during processing delays. ■ Preserves message order during transaction rollback or session recovery. Oracle recommends applications that use Ordered Redelivery upgrade to Message Unit-of-Order. For more information, see Chapter 10, Using Message Unit-of-Order.3.5 Topics vs. Queues
Surprisingly, when you are starting to design your application, it is not always immediately obvious whether it would be better to use a Topic or Queue. In general, you should choose a Topic only if one of the following conditions applies: ■ The same message must be replicated to multiple consumers. ■ A message should be dropped if there are no active consumers that would select it. ■ There are many subscribers, each with a unique selector. It is interesting to note that a topic with a single durable subscriber is semantically similar to a queue. The differences are as follows: ■ If you change a topic selector for a durable subscriber, all previous messages in the subscription are deleted, while if you change a queue selector for consumer, no messages in the queue are deleted. ■ A queue may have multiple consumers, and will distribute its messages in a round-robin fashion, whereas a topic subscriber is limited to only one consumer. For more information on configuring JMS queues and topics, see Queue and Topic Destination Resources in Configuring and Managing JMS for Oracle WebLogic Server.3.6 Asynchronous vs. Synchronous Consumers
In general, asynchronous onMessage consumers perform and scale better than synchronous consumers: ■ Asynchronous consumers create less network traffic. Messages are pushed unidirectionally, and are pipelined to the message listener. Pipelining supports the aggregation of multiple messages into a single network call. Note: In WebLogic Server, your synchronous consumers can also use the same efficient behavior as asynchronous consumers by enabling the Prefetch Mode for Synchronous Consumers option on JMS connection factories, as described in Section 5.4.2.1, Use Prefetch Mode to Create a Synchronous Message Pipeline. 3-4 Programming JMS for Oracle WebLogic Server ■ Asynchronous consumers use fewer threads. An asynchronous consumer does not use a thread while it is inactive. A synchronous consumer consumes a thread for the duration of its receive call. As a result, a thread can remain idle for long periods, especially if the call specifies a blocking timeout. ■ For application code that runs on a server, it is almost always best to use asynchronous consumers, typically via MDBs. The use of asynchronous consumers prevents the application code from doing a blocking operation on the server. A blocking operation, in turn, idles a server-side thread; it can even cause deadlocks. Deadlocks occur when blocking operations consume all threads. When no threads remain to handle the operations required to unblock the blocking operation itself, that operation never stops blocking. For more information, see Section 5.4.1, Receiving Messages Asynchronously and Section 5.4.2, Receiving Messages Synchronously.3.7 Persistent vs. Non-Persistent Messages
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