/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
*
* If applicable add the following below this CDDL HEADER,
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* @(#)QueueReceiverImpl.java 1.8 05/02/06
*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*/
package com.sun.messaging.jmq.jmsclient;
import javax.jms.*;
/** A client uses a QueueReceiver for receiving messages that have been
* delivered to a queue.
*
* <P>Although it is possible to have multiple QueueReceivers for the same queue,
* JMS does not define how messages are distributed between the QueueReceivers.
*
* @version 1.0 - 9 March 1998
* @author Mark Hapner
* @author Rich Burridge
*
* @see javax.jms.QueueSession#createReceiver(Queue, String)
* @see javax.jms.QueueSession#createReceiver(Queue)
* @see javax.jms.MessageConsumer
*/
public class QueueReceiverImpl extends MessageConsumerImpl implements QueueReceiver{
private Queue queue = null;
public QueueReceiverImpl (SessionImpl session, Queue queue)
throws JMSException {
super (session, queue);
this.queue = queue;
//setIsTopic ( false );
init(); //register interest
}
public QueueReceiverImpl (SessionImpl session, Queue queue,
String selector) throws JMSException {
//isTopic is false;
super (session, queue);
this.queue = queue;
//setIsTopic ( false );
setMessageSelector ( selector );
init(); //register interest
}
/** Get the queue associated with this queue receiver.
*
* @return the queue
*
* @exception JMSException if JMS fails to get queue for
* this queue receiver
* due to some internal error.
*/
public Queue
getQueue() throws JMSException {
checkState();
return queue;
}
}
|