KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > QueueConnection


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>QueueConnection</CODE> object is an active connection to a
28   * point-to-point JMS provider. A client uses a <CODE>QueueConnection</CODE>
29   * object to create one or more <CODE>QueueSession</CODE> objects
30   * for producing and consuming messages.
31   *
32   *<P>A <CODE>QueueConnection</CODE> can be used to create a
33   * <CODE>QueueSession</CODE>, from which specialized queue-related objects
34   * 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>QueueConnection</CODE> object
40   * should be used to support existing code that has already used it.
41   *
42   * <P>A <CODE>QueueConnection</CODE> cannot be used to create objects
43   * specific to the publish/subscribe domain. The
44   * <CODE>createDurableConnectionConsumer</CODE> method inherits
45   * from <CODE>Connection</CODE>, but must throw an
46   * <CODE>IllegalStateException</CODE>
47   * if used from <CODE>QueueConnection</CODE>.
48   *
49   * @version 1.1 - April 9, 2002
50   * @author Mark Hapner
51   * @author Rich Burridge
52   * @author Kate Stout
53   *
54   * @see javax.jms.Connection
55   * @see javax.jms.ConnectionFactory
56   * @see javax.jms.QueueConnectionFactory
57   */

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

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

111
112     ConnectionConsumer JavaDoc
113     createConnectionConsumer(Queue JavaDoc queue,
114                              String JavaDoc messageSelector,
115                              ServerSessionPool JavaDoc sessionPool,
116                  int maxMessages)
117                throws JMSException JavaDoc;
118 }
119
Popular Tags