|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.jms Class TopicRequestor
java.lang.Object javax.jms.TopicRequestor
public class TopicRequestor
- extends Object
TopicRequestor
帮助类简化了服务请求的建立。
TopicRequestor
构造方法提供有非事务性 TopicSession
和目的地 Topic
。它创建用于响应的 TemporaryTopic
,并提供发送请求消息和等待其回复的 request
方法。
这是基本的请求/回复抽象,应该足以满足大部分使用情况。JMS 提供者和客户端可以随意创建更复杂的版本。
version |
| |
See also | javax.jms.QueueRequestor |
The TopicRequestor
helper class simplifies
making service requests.
The TopicRequestor
constructor is given a non-transacted
TopicSession
and a destination Topic
. It creates a
TemporaryTopic
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:
QueueRequestor
Constructor Summary | |
---|---|
TopicRequestor(TopicSession session,
Topic topic)
Constructor for the TopicRequestor class. |
Method Summary | |
---|---|
void |
close()
Closes the TopicRequestor 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
TopicRequestor(TopicSession session, Topic topic) throws JMSException
TopicRequestor
类的构造方法。
此实现假定会话参数为非事务性,传送模式为 AUTO_ACKNOWLEDGE
或 DUPS_OK_ACKNOWLEDGE
。
session |
主题所属的 TopicSession |
topic | 要执行请求/回复调用的主题 |
Throws | JMSException:
如果 JMS 提供者由于某个内部错误无法创建 TopicRequestor 。 |
Throws | InvalidDestinationException: 如果指定了无效的主题。 |
TopicRequestor
public TopicRequestor(TopicSession session, Topic topic) throws JMSException
- Constructor for the
TopicRequestor
class.This implementation assumes the session parameter to be non-transacted, with a delivery mode of either
AUTO_ACKNOWLEDGE
orDUPS_OK_ACKNOWLEDGE
.- Parameters:
session
- theTopicSession
the topic belongs totopic
- the topic to perform the request/reply call on- Throws:
JMSException
- if the JMS provider fails to create theTopicRequestor
due to some internal error.InvalidDestinationException
- if an invalid topic 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 topic is used for
the
JMSReplyTo
destination; the first reply is returned, and any following replies are discarded. - 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
关闭 TopicRequestor
及其会话。
由于提供者可能会代表 TopicRequestor
分配 Java 虚拟机之外的某些资源,因此不需要这些资源时客户端应该关闭它们。依赖于垃圾收集最终回收这些资源可能不够及时。
注意,此方法关闭传递给 TopicRequestor
构造方法的 TopicSession
对象。
Throws | JMSException:
如果 JMS 提供者由于某个内部错误无法关闭 TopicRequestor 。 |
close
public void close() throws JMSException
- Closes the
TopicRequestor
and its session.Since a provider may allocate some resources on behalf of a
TopicRequestor
outside 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
TopicSession
object passed to theTopicRequestor
constructor. - Throws:
JMSException
- if the JMS provider fails to close theTopicRequestor
due 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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!