Message Persistence

   

JMS supports two modes of method delivery:

  • NON_PERSISTENT

  • PERSISTENT

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.

Caution

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.




Special Edition Using Enterprise JavaBeans 2.0
Special Edition Using Enterprise JavaBeans 2.0
ISBN: 0789725673
EAN: 2147483647
Year: 2000
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net