KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > QueueSession


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
26 package javax.jms;
27
28 /** A <CODE>QueueSession</CODE> object provides methods for creating
29   * <CODE>QueueReceiver</CODE>, <CODE>QueueSender</CODE>,
30   * <CODE>QueueBrowser</CODE>, and <CODE>TemporaryQueue</CODE> objects.
31   *
32   * <P>If there are messages that have been received but not acknowledged
33   * when a <CODE>QueueSession</CODE> terminates, these messages will be retained
34   * and redelivered when a consumer next accesses the queue.
35   *
36   *<P>A <CODE>QueueSession</CODE> is used for creating Point-to-Point specific
37   * objects. In general, use the <CODE>Session</CODE> object.
38   * The <CODE>QueueSession</CODE> is used to support
39   * existing code. Using the <CODE>Session</CODE> object simplifies the
40   * programming model, and allows transactions to be used across the two
41   * messaging domains.
42   *
43   * <P>A <CODE>QueueSession</CODE> cannot be used to create objects specific to the
44   * publish/subscribe domain. The following methods inherit from
45   * <CODE>Session</CODE>, but must throw an
46   * <CODE>IllegalStateException</CODE>
47   * if they are used from <CODE>QueueSession</CODE>:
48   *<UL>
49   * <LI><CODE>createDurableSubscriber</CODE>
50   * <LI><CODE>createTemporaryTopic</CODE>
51   * <LI><CODE>createTopic</CODE>
52   * <LI><CODE>unsubscribe</CODE>
53   * </UL>
54   *
55   * @version 1.1 - April 2, 2002
56   * @author Mark Hapner
57   * @author Rich Burridge
58   * @author Kate Stout
59   *
60   * @see javax.jms.Session
61   * @see javax.jms.QueueConnection#createQueueSession(boolean, int)
62   * @see javax.jms.XAQueueSession#getQueueSession()
63   */

64
65 public interface QueueSession extends Session JavaDoc {
66
67     /** Creates a queue identity given a <CODE>Queue</CODE> name.
68       *
69       * <P>This facility is provided for the rare cases where clients need to
70       * dynamically manipulate queue identity. It allows the creation of a
71       * queue identity with a provider-specific name. Clients that depend
72       * on this ability are not portable.
73       *
74       * <P>Note that this method is not for creating the physical queue.
75       * The physical creation of queues is an administrative task and is not
76       * to be initiated by the JMS API. The one exception is the
77       * creation of temporary queues, which is accomplished with the
78       * <CODE>createTemporaryQueue</CODE> method.
79       *
80       * @param queueName the name of this <CODE>Queue</CODE>
81       *
82       * @return a <CODE>Queue</CODE> with the given name
83       *
84       * @exception JMSException if the session fails to create a queue
85       * due to some internal error.
86       */

87  
88     Queue JavaDoc
89     createQueue(String JavaDoc queueName) throws JMSException JavaDoc;
90
91
92     /** Creates a <CODE>QueueReceiver</CODE> object to receive messages from the
93       * specified queue.
94       *
95       * @param queue the <CODE>Queue</CODE> to access
96       *
97       * @exception JMSException if the session fails to create a receiver
98       * due to some internal error.
99       * @exception InvalidDestinationException if an invalid queue is specified.
100       */

101
102     QueueReceiver JavaDoc
103     createReceiver(Queue JavaDoc queue) throws JMSException JavaDoc;
104
105
106     /** Creates a <CODE>QueueReceiver</CODE> object to receive messages from the
107       * specified queue using a message selector.
108       *
109       * @param queue the <CODE>Queue</CODE> to access
110       * @param messageSelector only messages with properties matching the
111       * message selector expression are delivered. A value of null or
112       * an empty string indicates that there is no message selector
113       * for the message consumer.
114       *
115       * @exception JMSException if the session fails to create a receiver
116       * due to some internal error.
117       * @exception InvalidDestinationException if an invalid queue is specified.
118       * @exception InvalidSelectorException if the message selector is invalid.
119       *
120       */

121
122     QueueReceiver JavaDoc
123     createReceiver(Queue JavaDoc queue,
124            String JavaDoc messageSelector) throws JMSException JavaDoc;
125
126
127     /** Creates a <CODE>QueueSender</CODE> object to send messages to the
128       * specified queue.
129       *
130       * @param queue the <CODE>Queue</CODE> to access, or null if this is an
131       * unidentified producer
132       *
133       * @exception JMSException if the session fails to create a sender
134       * due to some internal error.
135       * @exception InvalidDestinationException if an invalid queue is specified.
136       */

137  
138     QueueSender JavaDoc
139     createSender(Queue JavaDoc queue) throws JMSException JavaDoc;
140
141
142     /** Creates a <CODE>QueueBrowser</CODE> object to peek at the messages on
143       * the specified queue.
144       *
145       * @param queue the <CODE>Queue</CODE> to access
146       *
147       * @exception JMSException if the session fails to create a browser
148       * due to some internal error.
149       * @exception InvalidDestinationException if an invalid queue is specified.
150       */

151
152     QueueBrowser JavaDoc
153     createBrowser(Queue JavaDoc queue) throws JMSException JavaDoc;
154
155
156     /** Creates a <CODE>QueueBrowser</CODE> object to peek at the messages on
157       * the specified queue using a message selector.
158       *
159       * @param queue the <CODE>Queue</CODE> to access
160       * @param messageSelector only messages with properties matching the
161       * message selector expression are delivered. A value of null or
162       * an empty string indicates that there is no message selector
163       * for the message consumer.
164       *
165       * @exception JMSException if the session fails to create a browser
166       * due to some internal error.
167       * @exception InvalidDestinationException if an invalid queue is specified.
168       * @exception InvalidSelectorException if the message selector is invalid.
169       */

170
171     QueueBrowser JavaDoc
172     createBrowser(Queue JavaDoc queue,
173           String JavaDoc messageSelector) throws JMSException JavaDoc;
174
175
176     /** Creates a <CODE>TemporaryQueue</CODE> object. Its lifetime will be that
177       * of the <CODE>QueueConnection</CODE> unless it is deleted earlier.
178       *
179       * @return a temporary queue identity
180       *
181       * @exception JMSException if the session fails to create a temporary queue
182       * due to some internal error.
183       */

184
185     TemporaryQueue JavaDoc
186     createTemporaryQueue() throws JMSException JavaDoc;
187 }
188
Popular Tags