001: /*
002: * @(#)QueueConnection.java 1.22 02/04/10
003: *
004: * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
005: *
006: * SUN PROPRIETARY/CONFIDENTIAL.
007: * This software is the proprietary information of Sun Microsystems, Inc.
008: * Use is subject to license terms.
009: *
010: */
011:
012: package javax.jms;
013:
014: /** A <CODE>QueueConnection</CODE> object is an active connection to a
015: * point-to-point JMS provider. A client uses a <CODE>QueueConnection</CODE>
016: * object to create one or more <CODE>QueueSession</CODE> objects
017: * for producing and consuming messages.
018: *
019: *<P>A <CODE>QueueConnection</CODE> can be used to create a
020: * <CODE>QueueSession</CODE>, from which specialized queue-related objects
021: * can be created.
022: * A more general, and recommended, approach is to use the
023: * <CODE>Connection</CODE> object.
024: *
025: *
026: * <P>The <CODE>QueueConnection</CODE> object
027: * should be used to support existing code that has already used it.
028: *
029: * <P>A <CODE>QueueConnection</CODE> cannot be used to create objects
030: * specific to the publish/subscribe domain. The
031: * <CODE>createDurableConnectionConsumer</CODE> method inherits
032: * from <CODE>Connection</CODE>, but must throw an
033: * <CODE>IllegalStateException</CODE>
034: * if used from <CODE>QueueConnection</CODE>.
035: *
036: * @version 1.1 - April 9, 2002
037: * @author Mark Hapner
038: * @author Rich Burridge
039: * @author Kate Stout
040: *
041: * @see javax.jms.Connection
042: * @see javax.jms.ConnectionFactory
043: * @see javax.jms.QueueConnectionFactory
044: */
045:
046: public interface QueueConnection extends Connection {
047:
048: /** Creates a <CODE>QueueSession</CODE> object.
049: *
050: * @param transacted indicates whether the session is transacted
051: * @param acknowledgeMode indicates whether the consumer or the
052: * client will acknowledge any messages it receives; ignored if the session
053: * is transacted. Legal values are <code>Session.AUTO_ACKNOWLEDGE</code>,
054: * <code>Session.CLIENT_ACKNOWLEDGE</code>, and
055: * <code>Session.DUPS_OK_ACKNOWLEDGE</code>.
056: *
057: * @return a newly created queue session
058: *
059: * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
060: * to create a session due to some internal error or
061: * lack of support for the specific transaction
062: * and acknowledgement mode.
063: *
064: * @see Session#AUTO_ACKNOWLEDGE
065: * @see Session#CLIENT_ACKNOWLEDGE
066: * @see Session#DUPS_OK_ACKNOWLEDGE
067: */
068:
069: QueueSession createQueueSession(boolean transacted,
070: int acknowledgeMode) throws JMSException;
071:
072: /** Creates a connection consumer for this connection (optional operation).
073: * This is an expert facility not used by regular JMS clients.
074: *
075: * @param queue the queue to access
076: * @param messageSelector only messages with properties matching the
077: * message selector expression are delivered. A value of null or
078: * an empty string indicates that there is no message selector
079: * for the message consumer.
080: * @param sessionPool the server session pool to associate with this
081: * connection consumer
082: * @param maxMessages the maximum number of messages that can be
083: * assigned to a server session at one time
084: *
085: * @return the connection consumer
086: *
087: * @exception JMSException if the <CODE>QueueConnection</CODE> object fails
088: * to create a connection consumer due to some
089: * internal error or invalid arguments for
090: * <CODE>sessionPool</CODE> and
091: * <CODE>messageSelector</CODE>.
092: * @exception InvalidDestinationException if an invalid queue is specified.
093: * @exception InvalidSelectorException if the message selector is invalid.
094: * @see javax.jms.ConnectionConsumer
095: */
096:
097: ConnectionConsumer createConnectionConsumer(Queue queue,
098: String messageSelector, ServerSessionPool sessionPool,
099: int maxMessages) throws JMSException;
100: }
|