1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2000-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License ("CDDL") (collectively, the "License"). You may
9 * not use this file except in compliance with the License. You can obtain
10 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11 * or mq/legal/LICENSE.txt. See the License for the specific language
12 * governing permissions and limitations under the License.
13 *
14 * When distributing the software, include this License Header Notice in each
15 * file and include the License file at mq/legal/LICENSE.txt. Sun designates
16 * this particular file as subject to the "Classpath" exception as provided by
17 * Sun in the GPL Version 2 section of the License file that accompanied this
18 * code. If applicable, add the following below the License Header, with the
19 * fields enclosed by brackets [] replaced by your own identifying information:
20 * "Portions Copyrighted [year] [name of copyright owner]"
21 *
22 * Contributor(s):
23 *
24 * If you wish your version of this file to be governed by only the CDDL or
25 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26 * elects to include this software in this distribution under the [CDDL or GPL
27 * Version 2] license." If you don't indicate a single choice of license, a
28 * recipient has the option to distribute your version of this file under
29 * either the CDDL, the GPL Version 2 or to extend the choice of license to
30 * its licensees as provided above. However, if you add GPL Version 2 code
31 * and therefore, elected the GPL Version 2 license, then the option applies
32 * only if the new code is made subject to such option by the copyright holder.
33 */
34
35 /*
36 * @(#)QueueConnection.java 1.24 07/02/07
37 */
38
39 package javax.jms;
40
41 /** A <CODE>QueueConnection</CODE> object is an active connection to a
42 * point-to-point JMS provider. A client uses a <CODE>QueueConnection</CODE>
43 * object to create one or more <CODE>QueueSession</CODE> objects
44 * for producing and consuming messages.
45 *
46 *<P>A <CODE>QueueConnection</CODE> can be used to create a
47 * <CODE>QueueSession</CODE>, from which specialized queue-related objects
48 * can be created.
49 * A more general, and recommended, approach is to use the
50 * <CODE>Connection</CODE> object.
51 *
52 *
53 * <P>The <CODE>QueueConnection</CODE> object
54 * should be used to support existing code that has already used it.
55 *
56 * <P>A <CODE>QueueConnection</CODE> cannot be used to create objects
57 * specific to the publish/subscribe domain. The
58 * <CODE>createDurableConnectionConsumer</CODE> method inherits
59 * from <CODE>Connection</CODE>, but must throw an
60 * <CODE>IllegalStateException</CODE>
61 * if used from <CODE>QueueConnection</CODE>.
62 *
63 * @see javax.jms.Connection
64 * @see javax.jms.ConnectionFactory
65 * @see javax.jms.QueueConnectionFactory
66 */
67
68 public interface QueueConnection extends Connection {
69
70 /** Creates a <CODE>QueueSession</CODE> object.
71 *
72 * @param transacted indicates whether the session is transacted
73 * @param acknowledgeMode indicates whether the consumer or the
74 * client will acknowledge any messages it receives; ignored if the session
75 * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
76 * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
77 * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
78 *
79 * @return a newly created queue session
80 *
81 * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
82 * to create a session due to some internal error or
83 * lack of support for the specific transaction
84 * and acknowledgement mode.
85 *
86 * @see Session#AUTO_ACKNOWLEDGE
87 * @see Session#CLIENT_ACKNOWLEDGE
88 * @see Session#DUPS_OK_ACKNOWLEDGE
89 */
90
91 QueueSession
92 createQueueSession(boolean transacted,
93 int acknowledgeMode) throws JMSException;
94
95
96 /** Creates a connection consumer for this connection (optional operation).
97 * This is an expert facility not used by regular JMS clients.
98 *
99 * @param queue the queue to access
100 * @param messageSelector only messages with properties matching the
101 * message selector expression are delivered. A value of null or
102 * an empty string indicates that there is no message selector
103 * for the message consumer.
104 * @param sessionPool the server session pool to associate with this
105 * connection consumer
106 * @param maxMessages the maximum number of messages that can be
107 * assigned to a server session at one time
108 *
109 * @return the connection consumer
110 *
111 * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
112 * to create a connection consumer due to some
113 * internal error or invalid arguments for
114 * <CODE>sessionPool</CODE> and
115 * <CODE>messageSelector</CODE>.
116 * @exception InvalidDestinationException if an invalid queue is specified.
117 * @exception InvalidSelectorException if the message selector is invalid.
118 * @see javax.jms.ConnectionConsumer
119 */
120
121 ConnectionConsumer
122 createConnectionConsumer(Queue queue,
123 String messageSelector,
124 ServerSessionPool sessionPool,
125 int maxMessages)
126 throws JMSException;
127 }