QueueConnection (Java EE 5)

Java EE API


javax.jms Interface QueueConnection

All Superinterfaces:
Connection
All Known Subinterfaces:
XAQueueConnection

public interface QueueConnection
extends Connection

Implements: Connection
Implemented by: XAQueueConnection

QueueConnection 对象是到点对点 JMS 提供者的活动连接。客户端使用 QueueConnection 对象创建一个或多个生产和使用消息的 QueueSession 对象。

QueueConnection 可用于创建 QueueSession,可以从 QueueSession 中创建专门的与队列有关的对象。 一种更常用且建议采用的方法是使用 Connection 对象。

QueueConnection 对象 应用于支持已使用该对象的现有代码。

QueueConnection 无法用于创建 特定于发布/订阅域的对象。 createDurableConnectionConsumer 方法继承自 Connection,但如果在 QueueConnection使用,则必须抛出 IllegalStateException

英文文档:

A QueueConnection object is an active connection to a point-to-point JMS provider. A client uses a QueueConnection object to create one or more QueueSession objects for producing and consuming messages.

A QueueConnection can be used to create a QueueSession, from which specialized queue-related objects can be created. A more general, and recommended, approach is to use the Connection object.

The QueueConnection object should be used to support existing code that has already used it.

A QueueConnection cannot be used to create objects specific to the publish/subscribe domain. The createDurableConnectionConsumer method inherits from Connection, but must throw an IllegalStateException if used from QueueConnection.

Version:
1.1 - April 9, 2002
Author:
Mark Hapner, Rich Burridge, Kate Stout
See Also:
Connection, ConnectionFactory, QueueConnectionFactory

Method Summary
 ConnectionConsumer
 QueueSession
 
Methods inherited from interface javax.jms.Connection
 

Method Detail

public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException
创建 QueueSession 对象。
transacted 指示会话是否是事务性的
acknowledgeMode 指示使用方或 客户端是否将确认收到的任何消息;如果 会话是事务性的,则忽略此参数。合法值是 Session.AUTO_ACKNOWLEDGESession.CLIENT_ACKNOWLEDGESession.DUPS_OK_ACKNOWLEDGE
return 新建的队列会话
ThrowsJMSException: 如果 QueueConnection 对象 由于某个内部错误或 缺少对特定事务 和确认模式的支持无法创建会话。
See also AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE
英文文档:

createQueueSession

QueueSession createQueueSession(boolean transacted,
                                int acknowledgeMode)
                                throws JMSException
Creates a QueueSession object.

Parameters:
transacted - indicates whether the session is transacted
acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives; ignored if the session is transacted. Legal values are Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, and Session.DUPS_OK_ACKNOWLEDGE.
Returns:
a newly created queue session
Throws:
JMSException - if the QueueConnection 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(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
创建此连接的连接使用方(可选操作)。 这是一个专家级工具,常规 JMS 客户端不使用。
queue 要访问的队列
messageSelector 仅传送属性 与消息选择器表达式相匹配的消息。值为 null 或 空字符串表示该消息使用方没有消息选择器 。
sessionPool 与此连接使用方关联的服务器会话池
maxMessages 可以一次分配给服务器会话的最大消息数
return 连接使用方
ThrowsJMSException: 如果 QueueConnection 对象 由于某个内部错误 或 sessionPoolmessageSelector 的无效参数无法创建连接使用方。
ThrowsInvalidDestinationException: 如果指定了无效的队列。
ThrowsInvalidSelectorException: 如果消息选择器无效。
See also javax.jms.ConnectionConsumer
英文文档:

createConnectionConsumer

ConnectionConsumer createConnectionConsumer(Queue queue,
                                            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:
queue - the queue to access
messageSelector - 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 consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the connection consumer
Throws:
JMSException - if the QueueConnection object fails to create a connection consumer due to some internal error or invalid arguments for sessionPool and messageSelector.
InvalidDestinationException - if an invalid queue is specified.
InvalidSelectorException - if the message selector is invalid.
See Also:
ConnectionConsumer


Submit a bug or feature

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

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

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