KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > TopicConnection


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 /** A <CODE>TopicConnection</CODE> object is an active connection to a
28   * publish/subscribe JMS provider. A client uses a <CODE>TopicConnection</CODE>
29   * object to create one or more <CODE>TopicSession</CODE> objects
30   * for producing and consuming messages.
31   *
32   *<P>A <CODE>TopicConnection</CODE> can be used to create a
33   *<CODE>TopicSession</CODE>, from which
34   * specialized topic-related objects can be created.
35   * A more general, and recommended approach is to use the
36   * <CODE>Connection</CODE> object.
37   *
38   *
39   * <P>The <CODE>TopicConnection</CODE> object
40   * should be used to support existing code.
41   *
42   * @version 1.1 - February 2, 2002
43   * @author Mark Hapner
44   * @author Rich Burridge
45   * @author Kate Stout
46   *
47   * @see javax.jms.Connection
48   * @see javax.jms.ConnectionFactory
49   * @see javax.jms.TopicConnectionFactory
50   */

51
52 public interface TopicConnection extends Connection JavaDoc {
53
54     /** Creates a <CODE>TopicSession</CODE> object.
55       *
56       * @param transacted indicates whether the session is transacted
57       * @param acknowledgeMode indicates whether the consumer or the
58       * client will acknowledge any messages it receives; ignored if the session
59       * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
60       * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
61       * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
62       *
63       * @return a newly created topic session
64       *
65       * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
66       * to create a session due to some internal error or
67       * lack of support for the specific transaction
68       * and acknowledgement mode.
69       *
70       * @see Session#AUTO_ACKNOWLEDGE
71       * @see Session#CLIENT_ACKNOWLEDGE
72       * @see Session#DUPS_OK_ACKNOWLEDGE
73       */

74
75     TopicSession JavaDoc
76     createTopicSession(boolean transacted,
77                        int acknowledgeMode) throws JMSException JavaDoc;
78
79
80     /** Creates a connection consumer for this connection (optional operation).
81       * This is an expert facility not used by regular JMS clients.
82       *
83       * @param topic the topic to access
84       * @param messageSelector only messages with properties matching the
85       * message selector expression are delivered. A value of null or
86       * an empty string indicates that there is no message selector
87       * for the message consumer.
88       * @param sessionPool the server session pool to associate with this
89       * connection consumer
90       * @param maxMessages the maximum number of messages that can be
91       * assigned to a server session at one time
92       *
93       * @return the connection consumer
94       *
95       * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
96       * to create a connection consumer due to some
97       * internal error or invalid arguments for
98       * <CODE>sessionPool</CODE> and
99       * <CODE>messageSelector</CODE>.
100       * @exception InvalidDestinationException if an invalid topic is specified.
101       * @exception InvalidSelectorException if the message selector is invalid.
102       * @see javax.jms.ConnectionConsumer
103       */

104
105     ConnectionConsumer JavaDoc
106     createConnectionConsumer(Topic JavaDoc topic,
107                              String JavaDoc messageSelector,
108                              ServerSessionPool JavaDoc sessionPool,
109                  int maxMessages)
110                  throws JMSException JavaDoc;
111
112
113     /** Create a durable connection consumer for this connection (optional operation).
114       * This is an expert facility not used by regular JMS clients.
115       *
116       * @param topic the topic to access
117       * @param subscriptionName durable subscription name
118       * @param messageSelector only messages with properties matching the
119       * message selector expression are delivered. A value of null or
120       * an empty string indicates that there is no message selector
121       * for the message consumer.
122       * @param sessionPool the server session pool to associate with this
123       * durable connection consumer
124       * @param maxMessages the maximum number of messages that can be
125       * assigned to a server session at one time
126       *
127       * @return the durable connection consumer
128       *
129       * @exception JMSException if the <CODE>TopicConnection</CODE> object fails
130       * to create a connection consumer due to some
131       * internal error or invalid arguments for
132       * <CODE>sessionPool</CODE> and
133       * <CODE>messageSelector</CODE>.
134       * @exception InvalidDestinationException if an invalid topic is specified.
135       * @exception InvalidSelectorException if the message selector is invalid.
136       * @see javax.jms.ConnectionConsumer
137       */

138
139     ConnectionConsumer JavaDoc
140     createDurableConnectionConsumer(Topic JavaDoc topic,
141                     String JavaDoc subscriptionName,
142                                     String JavaDoc messageSelector,
143                                     ServerSessionPool JavaDoc sessionPool,
144                     int maxMessages)
145                              throws JMSException JavaDoc;
146 }
147
Popular Tags