001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.jms;
023:
024: /** A <CODE>QueueConnection</CODE> object is an active connection to a
025: * point-to-point JMS provider. A client uses a <CODE>QueueConnection</CODE>
026: * object to create one or more <CODE>QueueSession</CODE> objects
027: * for producing and consuming messages.
028: *
029: *<P>A <CODE>QueueConnection</CODE> can be used to create a
030: * <CODE>QueueSession</CODE>, from which specialized queue-related objects
031: * can be created.
032: * A more general, and recommended, approach is to use the
033: * <CODE>Connection</CODE> object.
034: *
035: *
036: * <P>The <CODE>QueueConnection</CODE> object
037: * should be used to support existing code that has already used it.
038: *
039: * <P>A <CODE>QueueConnection</CODE> cannot be used to create objects
040: * specific to the publish/subscribe domain. The
041: * <CODE>createDurableConnectionConsumer</CODE> method inherits
042: * from <CODE>Connection</CODE>, but must throw an
043: * <CODE>IllegalStateException</CODE>
044: * if used from <CODE>QueueConnection</CODE>.
045: *
046: * @see javax.jms.Connection
047: * @see javax.jms.ConnectionFactory
048: * @see javax.jms.QueueConnectionFactory
049: */
050:
051: public interface QueueConnection extends Connection {
052:
053: /** Creates a <CODE>QueueSession</CODE> object.
054: *
055: * @param transacted indicates whether the session is transacted
056: * @param acknowledgeMode indicates whether the consumer or the
057: * client will acknowledge any messages it receives; ignored if the session
058: * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
059: * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
060: * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
061: *
062: * @return a newly created queue session
063: *
064: * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
065: * to create a session due to some internal error or
066: * lack of support for the specific transaction
067: * and acknowledgement mode.
068: *
069: * @see Session#AUTO_ACKNOWLEDGE
070: * @see Session#CLIENT_ACKNOWLEDGE
071: * @see Session#DUPS_OK_ACKNOWLEDGE
072: */
073:
074: QueueSession createQueueSession(boolean transacted,
075: int acknowledgeMode) throws JMSException;
076:
077: /** Creates a connection consumer for this connection (optional operation).
078: * This is an expert facility not used by regular JMS clients.
079: *
080: * @param queue the queue to access
081: * @param messageSelector only messages with properties matching the
082: * message selector expression are delivered. A value of null or
083: * an empty string indicates that there is no message selector
084: * for the message consumer.
085: * @param sessionPool the server session pool to associate with this
086: * connection consumer
087: * @param maxMessages the maximum number of messages that can be
088: * assigned to a server session at one time
089: *
090: * @return the connection consumer
091: *
092: * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
093: * to create a connection consumer due to some
094: * internal error or invalid arguments for
095: * <CODE>sessionPool</CODE> and
096: * <CODE>messageSelector</CODE>.
097: * @exception InvalidDestinationException if an invalid queue is specified.
098: * @exception InvalidSelectorException if the message selector is invalid.
099: * @see javax.jms.ConnectionConsumer
100: */
101:
102: ConnectionConsumer createConnectionConsumer(Queue queue,
103: String messageSelector, ServerSessionPool sessionPool,
104: int maxMessages) throws JMSException;
105: }
|