-
- All Superinterfaces:
- AutoCloseable, MessageConsumer
public interface QueueReceiver extends MessageConsumer
A client uses aQueueReceiver
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 theQueueReceiver
s.If a
QueueReceiver
specifies a message selector, the messages that are not selected remain on the queue. By definition, a message selector allows aQueueReceiver
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. OnlyQueueReceiver
s without a message selector will read messages in message producer order.Creating a
MessageConsumer
provides the same features as creating aQueueReceiver
. AMessageConsumer
object is recommended for creating new code. TheQueueReceiver
is provided to support existing code.- Since:
- JMS 1.0
- Version:
- JMS 2.0
- See Also:
Session.createConsumer(Destination, String)
,Session.createConsumer(Destination)
,QueueSession.createReceiver(Queue, String)
,QueueSession.createReceiver(Queue)
,MessageConsumer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Queue
getQueue()
Gets theQueue
associated with this queue receiver.-
Methods inherited from interface javax.jms.MessageConsumer
close, getMessageListener, getMessageSelector, receive, receive, receiveNoWait, setMessageListener
-
-
-
-
Method Detail
-
getQueue
Queue getQueue() throws JMSException
Gets theQueue
associated with this queue receiver.- Returns:
- this receiver's
Queue
- Throws:
JMSException
- if the JMS provider fails to get the queue for this queue receiver due to some internal error.
-
-
Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/jms/QueueReceiver.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.