1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22 package javax.jms;
23
24 /** A <CODE>TopicConnection</CODE> object is an active connection to a
25 * publish/subscribe JMS provider. A client uses a <CODE>TopicConnection</CODE>
26 * object to create one or more <CODE>TopicSession</CODE> objects
27 * for producing and consuming messages.
28 *
29 *<P>A <CODE>TopicConnection</CODE> can be used to create a
30 *<CODE>TopicSession</CODE>, from which
31 * specialized topic-related objects can be created.
32 * A more general, and recommended approach is to use the
33 * <CODE>Connection</CODE> object.
34 *
35 *
36 * <P>The <CODE>TopicConnection</CODE> object
37 * should be used to support existing code.
38 *
39 * @see javax.jms.Connection
40 * @see javax.jms.ConnectionFactory
41 * @see javax.jms.TopicConnectionFactory
42 */
43
44 public interface TopicConnection extends Connection
45 {
46
47 /** Creates a <CODE>TopicSession</CODE> object.
48 *
49 * @param transacted indicates whether the session is transacted
50 * @param acknowledgeMode indicates whether the consumer or the
51 * client will acknowledge any messages it receives; ignored if the session
52 * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
53 * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
54 * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
55 *
56 * @return a newly created topic session
57 *
58 * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
59 * to create a session due to some internal error or
60 * lack of support for the specific transaction
61 * and acknowledgement mode.
62 *
63 * @see Session#AUTO_ACKNOWLEDGE
64 * @see Session#CLIENT_ACKNOWLEDGE
65 * @see Session#DUPS_OK_ACKNOWLEDGE
66 */
67
68 TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException;
69
70 /** Creates a connection consumer for this connection (optional operation).
71 * This is an expert facility not used by regular JMS clients.
72 *
73 * @param topic the topic to access
74 * @param messageSelector only messages with properties matching the
75 * message selector expression are delivered. A value of null or
76 * an empty string indicates that there is no message selector
77 * for the message consumer.
78 * @param sessionPool the server session pool to associate with this
79 * connection consumer
80 * @param maxMessages the maximum number of messages that can be
81 * assigned to a server session at one time
82 *
83 * @return the connection consumer
84 *
85 * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
86 * to create a connection consumer due to some
87 * internal error or invalid arguments for
88 * <CODE>sessionPool</CODE> and
89 * <CODE>messageSelector</CODE>.
90 * @exception InvalidDestinationException if an invalid topic is specified.
91 * @exception InvalidSelectorException if the message selector is invalid.
92 * @see javax.jms.ConnectionConsumer
93 */
94
95 ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool,
96 int maxMessages) throws JMSException;
97
98 /** Create a durable connection consumer for this connection (optional operation).
99 * This is an expert facility not used by regular JMS clients.
100 *
101 * @param topic the topic to access
102 * @param subscriptionName durable subscription name
103 * @param messageSelector only messages with properties matching the
104 * message selector expression are delivered. A value of null or
105 * an empty string indicates that there is no message selector
106 * for the message consumer.
107 * @param sessionPool the server session pool to associate with this
108 * durable connection consumer
109 * @param maxMessages the maximum number of messages that can be
110 * assigned to a server session at one time
111 *
112 * @return the durable connection consumer
113 *
114 * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
115 * to create a connection consumer due to some
116 * internal error or invalid arguments for
117 * <CODE>sessionPool</CODE> and
118 * <CODE>messageSelector</CODE>.
119 * @exception InvalidDestinationException if an invalid topic is specified.
120 * @exception InvalidSelectorException if the message selector is invalid.
121 * @see javax.jms.ConnectionConsumer
122 */
123
124 ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector,
125 ServerSessionPool sessionPool, int maxMessages) throws JMSException;
126 }