|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.jms Interface TopicConnection
- All Superinterfaces:
- Connection
- All Known Subinterfaces:
- XATopicConnection
public interface TopicConnection
- extends Connection
TopicConnection
对象是到发布/订阅 JMS 提供者的活动连接。客户端使用 TopicConnection
对象创建一个或多个生产和使用消息的 TopicSession
对象。
TopicConnection
可用于创建 TopicSession
,可以从 TopicSession
中创建专门的与主题有关的对象。一种更常用且建议采用的方法是使用 Connection
对象。
应该使用 TopicConnection
对象支持现有代码。
version |
| |
See also | javax.jms.Connection, javax.jms.ConnectionFactory, javax.jms.TopicConnectionFactory |
A TopicConnection
object is an active connection to a
publish/subscribe JMS provider. A client uses a TopicConnection
object to create one or more TopicSession
objects
for producing and consuming messages.
A TopicConnection
can be used to create a
TopicSession
, from which
specialized topic-related objects can be created.
A more general, and recommended approach is to use the
Connection
object.
The TopicConnection
object
should be used to support existing code.
- Version:
- 1.1 - February 2, 2002
- Author:
- Mark Hapner, Rich Burridge, Kate Stout
- See Also:
Connection
,ConnectionFactory
,TopicConnectionFactory
Method Summary | |
---|---|
ConnectionConsumer |
createConnectionConsumer(Topic topic,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Creates a connection consumer for this connection (optional operation). |
ConnectionConsumer |
createDurableConnectionConsumer(Topic topic,
String subscriptionName,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Create a durable connection consumer for this connection (optional operation). |
TopicSession |
createTopicSession(boolean transacted,
int acknowledgeMode)
Creates a TopicSession object. |
Methods inherited from interface javax.jms.Connection |
---|
close, createConnectionConsumer, createSession, getClientID, getExceptionListener, getMetaData, setClientID, setExceptionListener, start, stop |
Method Detail |
---|
public TopicSession
createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
创建 TopicSession
对象。
transacted | 指示会话是否是事务性的 |
acknowledgeMode |
指示使用方或客户端是否将确认收到的任何消息;如果会话是事务性的,则忽略此参数。合法值有 Session.AUTO_ACKNOWLEDGE 、Session.CLIENT_ACKNOWLEDGE 和 Session.DUPS_OK_ACKNOWLEDGE 。 |
return | 新建的主题会话 |
Throws | JMSException:
如果 TopicConnection 对象由于某个内部错误或缺少对特定事务和确认模式的支持无法创建会话。 |
See also | AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE |
createTopicSession
TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
- Creates a
TopicSession
object. - Parameters:
transacted
- indicates whether the session is transactedacknowledgeMode
- indicates whether the consumer or the client will acknowledge any messages it receives; ignored if the session is transacted. Legal values areSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, andSession.DUPS_OK_ACKNOWLEDGE
.- Returns:
- a newly created topic session
- Throws:
JMSException
- if theTopicConnection
object fails to create a session due to some internal error or lack of support for the specific transaction and acknowledgement mode.- See Also:
Session.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
,Session.DUPS_OK_ACKNOWLEDGE
public ConnectionConsumer
createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
创建此连接的连接使用方(可选操作)。这是一个专家级工具,常规 JMS 客户端不使用。
topic | 要访问的主题 |
messageSelector | 仅包括那些属性匹配所传送的消息选择器表达式的消息。值为 null 或空字符串表示该消息使用方没有消息选择器。 |
sessionPool | 与此连接使用方关联的服务器会话池 |
maxMessages | 可以一次分配给服务器会话的最大消息数 |
return | 连接使用方 |
Throws | JMSException:
如果 TopicConnection 对象由于某个内部错误或 sessionPool 和 messageSelector 的无效参数无法创建连接使用方。 |
Throws | InvalidDestinationException: 如果指定了无效的主题。 |
Throws | InvalidSelectorException: 如果消息选择器无效。 |
See also | javax.jms.ConnectionConsumer |
createConnectionConsumer
ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
- Creates a connection consumer for this connection (optional operation).
This is an expert facility not used by regular JMS clients.
- Parameters:
topic
- the topic to accessmessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.sessionPool
- the server session pool to associate with this connection consumermaxMessages
- the maximum number of messages that can be assigned to a server session at one time- Returns:
- the connection consumer
- Throws:
JMSException
- if theTopicConnection
object fails to create a connection consumer due to some internal error or invalid arguments forsessionPool
andmessageSelector
.InvalidDestinationException
- if an invalid topic is specified.InvalidSelectorException
- if the message selector is invalid.- See Also:
ConnectionConsumer
public ConnectionConsumer
createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
创建此连接的持久连接使用方(可选操作)。这是一个专家级工具,常规 JMS 客户端不使用。
topic | 要访问的主题 |
subscriptionName | 持久订阅名称 |
messageSelector | 仅包括那些属性匹配所传送的消息选择器表达式的消息。值为 null 或空字符串表示该消息使用方没有消息选择器。 |
sessionPool | 关联此持久连接使用方的服务器会话池 |
maxMessages | 可以一次分配给服务器会话的最大消息数 |
return | 持久连接使用方 |
Throws | JMSException:
如果 TopicConnection 对象由于某个内部错误或 sessionPool 和 messageSelector 的无效参数无法创建连接使用方。 |
Throws | InvalidDestinationException: 如果指定了无效的主题。 |
Throws | InvalidSelectorException: 如果消息选择器无效。 |
See also | javax.jms.ConnectionConsumer |
createDurableConnectionConsumer
ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
- Create a durable connection consumer for this connection (optional operation).
This is an expert facility not used by regular JMS clients.
- Specified by:
createDurableConnectionConsumer
in interfaceConnection
- Parameters:
topic
- the topic to accesssubscriptionName
- durable subscription namemessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.sessionPool
- the server session pool to associate with this durable connection consumermaxMessages
- the maximum number of messages that can be assigned to a server session at one time- Returns:
- the durable connection consumer
- Throws:
JMSException
- if theTopicConnection
object fails to create a connection consumer due to some internal error or invalid arguments forsessionPool
andmessageSelector
.InvalidDestinationException
- if an invalid topic is specified.InvalidSelectorException
- if the message selector is invalid.- See Also:
ConnectionConsumer
|
|||||||||
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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!