- Introduction to Messaging
- Components of the JMS Architecture
- The Two JMS Message Models
- The JMS Interfaces
- The Details of a JMS Message
- Message Selection and Filtering
- Using the JMS Point-to-Point Model
- Using the JMS Publish/Subscribe Model
- Synchronous Versus Asynchronous Messaging
- Message Persistence
- Using Transactions with JMS
- Using JMS with Enterprise JavaBeans
JMS supports two modes of method delivery:
Depending on the needs of your JMS application, NON_PERSISTENT message delivery offers the least amount of overhead and the best performance of the two modes. With the PERSISTENT mode of message delivery, the JMS server must guarantee that a message is delivered exactly once. The JMS server does this by taking extra care to ensure that the message is not lost after the MessageProducer sends it. The JMS server does so by using some type of persistent store to save the messages after they are sent.
With the NON_PERSISTENT delivery mode, a JMS provider does not take any extra precaution to ensure the message is saved or backed up. In case of a JMS server failure, messages might be lost. If your application needs to be sure that messages are delivered, you should use the PERSISTENT delivery mode.
Just because your application is using PERSISTENT method delivery does not absolutely guarantee that all messages are delivered to all expecting consumers. Issues such as expiration times and JMS resource limits may cause messages to be destroyed inadvertently. To help reduce the possibility of this from happening, it's recommended that you use PERSISTENT message delivery and both produce and consume messages within a transaction.