QueueReceiver (Java EE 5)

Java EE API


javax.jms Interface QueueReceiver

All Superinterfaces:
MessageConsumer

public interface QueueReceiver
extends MessageConsumer

Implements: MessageConsumer

客户端使用 QueueReceiver 对象接收已传送到某个队列的消息。

尽管相同队列可以有多个 QueueReceiver,但 JMS API 没有定义在 QueueReceiver 之间分布消息的方式。

如果 QueueReceiver 指定了消息选择器,则未选择的消息将保留在队列中。按照定义,消息选择器允许 QueueReceiver 跳过消息。这意味着当最终读取跳过的消息时,读取的总顺序不会保持每个消息生成方定义的部分顺序。只有没有消息选择器的 QueueReceiver 会按消息生成方顺序读取消息。

创建 MessageConsumer 所提供的功能与创建 QueueReceiver 所提供的功能相同。创建新代码时建议使用 MessageConsumer 对象。提供 QueueReceiver 的目的是支持现有代码。

英文文档:

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

Although it is possible to have multiple QueueReceivers 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 QueueReceivers 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.

Version:
1.1 February 2, 2002
Author:
Mark Hapner, Rich Burridge, Kate Stout
See Also:
Session.createConsumer(Destination, String), Session.createConsumer(Destination), QueueSession.createReceiver(Queue, String), QueueSession.createReceiver(Queue), MessageConsumer

Method Summary
 Queue
 
Methods inherited from interface javax.jms.MessageConsumer
 

Method Detail

public Queue getQueue() throws JMSException
获取与此队列接收者关联的 Queue
return 此接收者的 Queue
ThrowsJMSException: 如果 JMS 提供者由于某个内部错误无法获取此队列接收者的队列。
英文文档:

getQueue

Queue getQueue()
               throws JMSException
Gets the Queue 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.


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!