|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.jms Class QueueRequestor
java.lang.Objectjavax.jms.QueueRequestor
public class QueueRequestor
- extends Object
QueueRequestor 帮助类简化了服务请求的建立。
QueueRequestor 构造方法提供有非事务性 QueueSession 和目的地 Queue。它创建用于响应的 TemporaryQueue,并提供发送请求消息和等待其回复的 request 方法。
这是基本的请求/回复抽象,应该足以满足大部分使用情况。JMS 提供者和客户端可以随意创建更复杂的版本。
| version |
| |
| See also | javax.jms.TopicRequestor |
The QueueRequestor helper class simplifies
making service requests.
The QueueRequestor constructor is given a non-transacted
QueueSession and a destination Queue. It creates a
TemporaryQueue for the responses and provides a
request method that sends the request message and waits
for its reply.
This is a basic request/reply abstraction that should be sufficient for most uses. JMS providers and clients are free to create more sophisticated versions.
- Version:
- 1.0 - 8 July 1998
- Author:
- Mark Hapner, Rich Burridge
- See Also:
TopicRequestor
| Constructor Summary | |
|---|---|
QueueRequestor(QueueSession session,
Queue queue)
Constructor for the QueueRequestor class. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the QueueRequestor and its session. |
Message |
request(Message message)
Sends a request and waits for a reply. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public
QueueRequestor(QueueSession session, Queue queue) throws JMSException
QueueRequestor 类的构造方法。
此实现假定没有处理 session 参数,提交模式为 AUTO_ACKNOWLEDGE 或 DUPS_OK_ACKNOWLEDGE。
| session |
队列所属的 QueueSession |
| queue | 要执行请求/回复调用的队列 |
| Throws | JMSException:
如果 JMS 提供者由于某个内部错误无法创建 QueueRequestor。 |
| Throws | InvalidDestinationException: 如果指定了无效的队列。 |
QueueRequestor
public QueueRequestor(QueueSession session, Queue queue) throws JMSException
- Constructor for the
QueueRequestorclass.This implementation assumes the session parameter to be non-transacted, with a delivery mode of either
AUTO_ACKNOWLEDGEorDUPS_OK_ACKNOWLEDGE.- Parameters:
session- theQueueSessionthe queue belongs toqueue- the queue to perform the request/reply call on- Throws:
JMSException- if the JMS provider fails to create theQueueRequestordue to some internal error.InvalidDestinationException- if an invalid queue is specified.
| Method Detail |
|---|
public Message
request(Message message) throws JMSException
发送请求并等待回复。临时队列用于 JMSReplyTo 目的地,而且要求每个请求只有一个回复。
| message | 要发送的消息 |
| return | 回复消息 |
| Throws | JMSException: 如果 JMS 提供者由于某个内部错误无法完成请求。 |
request
public Message request(Message message) throws JMSException
- Sends a request and waits for a reply. The temporary queue is used for
the
JMSReplyTodestination, and only one reply per request is expected. - Parameters:
message- the message to send- Returns:
- the reply message
- Throws:
JMSException- if the JMS provider fails to complete the request due to some internal error.
public void
close() throws JMSException
关闭 QueueRequestor 及其会话。
由于提供者可能会代表 QueueRequestor 分配 Java 虚拟机之外的某些资源,因此不需要这些资源时客户端应该关闭它们。依赖于垃圾收集最终回收这些资源可能不够及时。
注意,此方法关闭传递给 QueueRequestor 构造方法的 QueueSession 对象。
| Throws | JMSException:
如果 JMS 提供者由于某个内部错误无法关闭 QueueRequestor。 |
close
public void close()
throws JMSException
- Closes the
QueueRequestorand its session.Since a provider may allocate some resources on behalf of a
QueueRequestoroutside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.Note that this method closes the
QueueSessionobject passed to theQueueRequestorconstructor. - Throws:
JMSException- if the JMS provider fails to close theQueueRequestordue to some internal error.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!
javax.jms.QueueRequestor