KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > DeliveryMode


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package javax.jms;
26
27 /** The delivery modes supported by the JMS API are <CODE>PERSISTENT</CODE> and
28   * <CODE>NON_PERSISTENT</CODE>.
29   *
30   * <P>A client marks a message as persistent if it feels that the
31   * application will have problems if the message is lost in transit.
32   * A client marks a message as non-persistent if an occasional
33   * lost message is tolerable. Clients use delivery mode to tell a
34   * JMS provider how to balance message transport reliability with throughput.
35   *
36   * <P>Delivery mode covers only the transport of the message to its
37   * destination. Retention of a message at the destination until
38   * its receipt is acknowledged is not guaranteed by a <CODE>PERSISTENT</CODE>
39   * delivery mode. Clients should assume that message retention
40   * policies are set administratively. Message retention policy
41   * governs the reliability of message delivery from destination
42   * to message consumer. For example, if a client's message storage
43   * space is exhausted, some messages may be dropped in accordance with
44   * a site-specific message retention policy.
45   *
46   * <P>A message is guaranteed to be delivered once and only once
47   * by a JMS provider if the delivery mode of the message is
48   * <CODE>PERSISTENT</CODE>
49   * and if the destination has a sufficient message retention policy.
50   *
51   *
52   *
53   * @version 1.0 - 7 August 1998
54   * @author Mark Hapner
55   * @author Rich Burridge
56   */

57
58 public interface DeliveryMode {
59
60     /** This is the lowest-overhead delivery mode because it does not require
61       * that the message be logged to stable storage. The level of JMS provider
62       * failure that causes a <CODE>NON_PERSISTENT</CODE> message to be lost is
63       * not defined.
64       *
65       * <P>A JMS provider must deliver a <CODE>NON_PERSISTENT</CODE> message
66       * with an
67       * at-most-once guarantee. This means that it may lose the message, but it
68       * must not deliver it twice.
69       */

70
71     static final int NON_PERSISTENT = 1;
72
73     /** This delivery mode instructs the JMS provider to log the message to stable
74       * storage as part of the client's send operation. Only a hard media
75       * failure should cause a <CODE>PERSISTENT</CODE> message to be lost.
76       */

77
78     static final int PERSISTENT = 2;
79 }
80
Popular Tags