1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.jms;
  6. /** The delivery modes supported by the JMS API are <CODE>PERSISTENT</CODE> and
  7. * <CODE>NON_PERSISTENT</CODE>.
  8. *
  9. * <P>A client marks a message as persistent if it feels that the
  10. * application will have problems if the message is lost in transit.
  11. * A client marks a message as non-persistent if an occasional
  12. * lost message is tolerable. Clients use delivery mode to tell a
  13. * JMS provider how to balance message transport reliability with throughput.
  14. *
  15. * <P>Delivery mode covers only the transport of the message to its
  16. * destination. Retention of a message at the destination until
  17. * its receipt is acknowledged is not guaranteed by a <CODE>PERSISTENT</CODE>
  18. * delivery mode. Clients should assume that message retention
  19. * policies are set administratively. Message retention policy
  20. * governs the reliability of message delivery from destination
  21. * to message consumer. For example, if a client's message storage
  22. * space is exhausted, some messages may be dropped in accordance with
  23. * a site-specific message retention policy.
  24. *
  25. * <P>A message is guaranteed to be delivered once and only once
  26. * by a JMS provider if the delivery mode of the message is
  27. * <CODE>PERSISTENT</CODE>
  28. * and if the destination has a sufficient message retention policy.
  29. *
  30. *
  31. *
  32. * @version 1.0 - 7 August 1998
  33. * @author Mark Hapner
  34. * @author Rich Burridge
  35. */
  36. public interface DeliveryMode {
  37. /** This is the lowest-overhead delivery mode because it does not require
  38. * that the message be logged to stable storage. The level of JMS provider
  39. * failure that causes a <CODE>NON_PERSISTENT</CODE> message to be lost is
  40. * not defined.
  41. *
  42. * <P>A JMS provider must deliver a <CODE>NON_PERSISTENT</CODE> message
  43. * with an
  44. * at-most-once guarantee. This means that it may lose the message, but it
  45. * must not deliver it twice.
  46. */
  47. static final int NON_PERSISTENT = 1;
  48. /** This delivery mode instructs the JMS provider to log the message to stable
  49. * storage as part of the client's send operation. Only a hard media
  50. * failure should cause a <CODE>PERSISTENT</CODE> message to be lost.
  51. */
  52. static final int PERSISTENT = 2;
  53. }