Part Two of Nigel Deakin’s series on JMS 2.0 (Java Message Service), titled “What's New in JMS 2.0, Part Two—New Messaging Features,” is now up on otn/java. While Part One looked at new ease-of-use features introduced in JMS 2.0, Part Two explores five important new messaging features.
First, a new kind of topic subscription called a shared subscription now allows for multiple consumers on the same topic subscription.
Second, developers can now specify a delivery delay on a message so that the JMS provider will not deliver the message until after the specified delivery delay has elapsed
Third, with JMS 2.0, users can send a message asynchronously. As Deakin explains, “This feature is available for applications running in Java SE or the Java EE application client container. It is not available to applications that run in the Java EE Web or EJB container.” According to Deakin, “When a message is sent asynchronously, the send method sends the message to the server and then returns control to the application without waiting for a reply from the server. Instead of being blocked unproductively while the JMS client waits for a reply, the application can do something useful, such as sending a further message or performing some processing.”
Deakin explains that there are two main ways in which you might use an asynchronous send in an application:
* To allow the application to do something else (such as update the display or write to a database) during the interval when it would otherwise be waiting for a reply from the server
* To allow a large number of messages to be sent in succession without waiting for a reply from the server after each message
Fourth, JMS 2.0 allows applications that receive a message to determine how many times the message has been redelivered.
And finally, a Java EE application that needs to receive messages asynchronously does so using an MDB, or message-driven bean, which is configured by specifying a number of configuration properties.
Check out the article here.