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 * @(#)TopicConnection.java 1.21 07/02/07
37 */
38
39 package javax.jms;
40
41 /** A <CODE>TopicConnection</CODE> object is an active connection to a
42 * publish/subscribe JMS provider. A client uses a <CODE>TopicConnection</CODE>
43 * object to create one or more <CODE>TopicSession</CODE> objects
44 * for producing and consuming messages.
45 *
46 *<P>A <CODE>TopicConnection</CODE> can be used to create a
47 *<CODE>TopicSession</CODE>, from which
48 * specialized topic-related objects 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>TopicConnection</CODE> object
54 * should be used to support existing code.
55 *
56 * @see javax.jms.Connection
57 * @see javax.jms.ConnectionFactory
58 * @see javax.jms.TopicConnectionFactory
59 */
60
61 public interface TopicConnection extends Connection {
62
63 /** Creates a <CODE>TopicSession</CODE> object.
64 *
65 * @param transacted indicates whether the session is transacted
66 * @param acknowledgeMode indicates whether the consumer or the
67 * client will acknowledge any messages it receives; ignored if the session
68 * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
69 * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
70 * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
71 *
72 * @return a newly created topic session
73 *
74 * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
75 * to create a session due to some internal error or
76 * lack of support for the specific transaction
77 * and acknowledgement mode.
78 *
79 * @see Session#AUTO_ACKNOWLEDGE
80 * @see Session#CLIENT_ACKNOWLEDGE
81 * @see Session#DUPS_OK_ACKNOWLEDGE
82 */
83
84 TopicSession
85 createTopicSession(boolean transacted,
86 int acknowledgeMode) throws JMSException;
87
88
89 /** Creates a connection consumer for this connection (optional operation).
90 * This is an expert facility not used by regular JMS clients.
91 *
92 * @param topic the topic to access
93 * @param messageSelector only messages with properties matching the
94 * message selector expression are delivered. A value of null or
95 * an empty string indicates that there is no message selector
96 * for the message consumer.
97 * @param sessionPool the server session pool to associate with this
98 * connection consumer
99 * @param maxMessages the maximum number of messages that can be
100 * assigned to a server session at one time
101 *
102 * @return the connection consumer
103 *
104 * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
105 * to create a connection consumer due to some
106 * internal error or invalid arguments for
107 * <CODE>sessionPool</CODE> and
108 * <CODE>messageSelector</CODE>.
109 * @exception InvalidDestinationException if an invalid topic is specified.
110 * @exception InvalidSelectorException if the message selector is invalid.
111 * @see javax.jms.ConnectionConsumer
112 */
113
114 ConnectionConsumer
115 createConnectionConsumer(Topic topic,
116 String messageSelector,
117 ServerSessionPool sessionPool,
118 int maxMessages)
119 throws JMSException;
120
121
122 /** Create a durable connection consumer for this connection (optional operation).
123 * This is an expert facility not used by regular JMS clients.
124 *
125 * @param topic the topic to access
126 * @param subscriptionName durable subscription name
127 * @param messageSelector only messages with properties matching the
128 * message selector expression are delivered. A value of null or
129 * an empty string indicates that there is no message selector
130 * for the message consumer.
131 * @param sessionPool the server session pool to associate with this
132 * durable connection consumer
133 * @param maxMessages the maximum number of messages that can be
134 * assigned to a server session at one time
135 *
136 * @return the durable connection consumer
137 *
138 * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
139 * to create a connection consumer due to some
140 * internal error or invalid arguments for
141 * <CODE>sessionPool</CODE> and
142 * <CODE>messageSelector</CODE>.
143 * @exception InvalidDestinationException if an invalid topic is specified.
144 * @exception InvalidSelectorException if the message selector is invalid.
145 * @see javax.jms.ConnectionConsumer
146 */
147
148 ConnectionConsumer
149 createDurableConnectionConsumer(Topic topic,
150 String subscriptionName,
151 String messageSelector,
152 ServerSessionPool sessionPool,
153 int maxMessages)
154 throws JMSException;
155 }