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 28 /** A client uses a <CODE>QueueReceiver</CODE> object to receive messages that 29 * have been delivered to a queue. 30 * 31 * <P>Although it is possible to have multiple <CODE>QueueReceiver</CODE>s 32 * for the same queue, the JMS API does not define how messages are 33 * distributed between the <CODE>QueueReceiver</CODE>s. 34 * 35 * <P>If a <CODE>QueueReceiver</CODE> specifies a message selector, the 36 * messages that are not selected remain on the queue. By definition, a message 37 * selector allows a <CODE>QueueReceiver</CODE> to skip messages. This 38 * means that when the skipped messages are eventually read, the total ordering 39 * of the reads does not retain the partial order defined by each message 40 * producer. Only <CODE>QueueReceiver</CODE>s without a message selector 41 * will read messages in message producer order. 42 * 43 * <P>Creating a <CODE>MessageConsumer</CODE> provides the same features as 44 * creating a <CODE>QueueReceiver</CODE>. A <CODE>MessageConsumer</CODE> object is 45 * recommended for creating new code. The <CODE>QueueReceiver</CODE> is 46 * provided to support existing code. 47 * 48 * @version 1.1 February 2, 2002 49 * @author Mark Hapner 50 * @author Rich Burridge 51 * @author Kate Stout 52 * 53 * @see javax.jms.Session#createConsumer(Destination, String) 54 * @see javax.jms.Session#createConsumer(Destination) 55 * @see javax.jms.QueueSession#createReceiver(Queue, String) 56 * @see javax.jms.QueueSession#createReceiver(Queue) 57 * @see javax.jms.MessageConsumer 58 */ 59 60 public interface QueueReceiver extends MessageConsumer { 61 62 /** Gets the <CODE>Queue</CODE> associated with this queue receiver. 63 * 64 * @return this receiver's <CODE>Queue</CODE> 65 * 66 * @exception JMSException if the JMS provider fails to get the queue for 67 * this queue receiver 68 * due to some internal error. 69 */ 70 71 Queue 72 getQueue() throws JMSException; 73 } 74