Kbase 20778: SonicMQ: PERSISTENT and NON_PERSISTENT delivery mode.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  04/04/2001 |
|
SUMMARY:
This Knowledgebase applies to SonicMQ Version 2000.1 and Version 3.0
It explains PERSISTENT and NON_PERSISTENT delivery mode.
EXPLANATION:
By setting the message delivery mode to PERSISTENT, the message is logged before the producer is acknowledged and is guaranteed to be retained in the final message server?s message store until it is either acknowledged as delivered or it expires. The value of PERSISTENT tells the broker to save the message. It carries a "once-and-only-once" guarantee, which assures that it will be delivered to each available subscriber.
What Are The Benefits of Choosing PERSISTENT Delivery Mode?
* To prevent the loss of messages due to system failure.
* To ensure "once-and-only-once" delivery.
* Reliability is more important than performance.
The PERSISTENT delivery mode applies to both messaging domains, Point-to-Point and Publish and Subscribe. This is an example of setting delivery mode to PERSISTENT in the Point-to-Point domain.
sender.send( msg,
javax.jms.DeliveryMode.PERSISTENT,
javax.jms.Message.DEFAULT_PRIORITY,
MESSAGE_LIFESPAN);
By setting the message delivery mode to NON_PERSISTENT, the
messages are volatile in the event of server failure. The value of NON_PERSISTENT tells the server that it should not save the message. It carries an "at-most-once" guarantee, which assures that it will not be delivered more than once to any subscriber, but it may not be delivered at all. NON_PERSISTENT messages should only be used when a loss of messages due to server failure is not an issue to your messaging system.
What Are The Benefits of Choosing NON_PERSISTENT Delivery Mode?
* Messages are not written to server's message store.
* Performance is more important than reliability.
The NON_PERSISTENT delivery mode applies to both messaging domains,
Point-to-Point and Publish and Subscribe. This is an example of setting delivery mode to NON_PERSISTENT in the Publish and Subscribe domain.
publisher.publish( msg,
javax.jms.DeliveryMode.NON_PERSISTENT,
javax.jms.Message.DEFAULT_PRIORITY,
MESSAGE_LIFESPAN);
Reference to Written Documentation:
SonicMQ Programming Guide
O'Reilly's "Java Message Service", by
Richard Monson-Haefel & David A. Chappell
http://java.sun.com/products/jms/docs.html
http://java.sun.com/products/jms/faq.html