All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.activemq.ActiveMQQueueReceiver Maven / Gradle / Ivy

There is a newer version: 5.7.0
Show newest version
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.activemq;

import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerId;

import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueReceiver;

/**
 * A client uses a QueueReceiver object to receive messages that
 * have been delivered to a queue.
 * 

*

* Although it is possible to have multiple QueueReceiver s for * the same queue, the JMS API does not define how messages are distributed * between the QueueReceivers. *

*

* If a QueueReceiver specifies a message selector, the messages * that are not selected remain on the queue. By definition, a message selector * allows a QueueReceiver to skip messages. This means that when * the skipped messages are eventually read, the total ordering of the reads * does not retain the partial order defined by each message producer. Only * QueueReceiver s without a message selector will read messages * in message producer order. *

*

* Creating a MessageConsumer provides the same features as * creating a QueueReceiver. A MessageConsumer * object is recommended for creating new code. The QueueReceiver * is provided to support existing code. * * @see javax.jms.Session#createConsumer(javax.jms.Destination, String) * @see javax.jms.Session#createConsumer(javax.jms.Destination) * @see javax.jms.QueueSession#createReceiver(Queue, String) * @see javax.jms.QueueSession#createReceiver(Queue) * @see javax.jms.MessageConsumer */ public class ActiveMQQueueReceiver extends ActiveMQMessageConsumer implements QueueReceiver { /** * @param theSession * @param value * @param destination * @param messageSelector * @param prefetch * @param asyncDispatch * @throws JMSException */ protected ActiveMQQueueReceiver(ActiveMQSession theSession, ConsumerId consumerId, ActiveMQDestination destination, String selector, int prefetch, int maximumPendingMessageCount, boolean asyncDispatch) throws JMSException { super(theSession, consumerId, destination, null, selector, prefetch, maximumPendingMessageCount, false, false, asyncDispatch); } /** * Gets the Queue associated with this queue receiver. * * @return this receiver's Queue * @throws JMSException if the JMS provider fails to get the queue for this queue * receiver due to some internal error. */ public Queue getQueue() throws JMSException { checkClosed(); return (Queue) super.getDestination(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy