|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.jms Interface QueueSession
public interface QueueSession
- extends Session
QueueSession 对象提供了创建 QueueReceiver、QueueSender、QueueBrowser 和 TemporaryQueue 对象的方法。
如果有些消息已被接收但在 QueueSession 终止时尚未得到确认,则这些消息将会保留,并在使用方下次访问该队列时重新传送。
QueueSession 用于创建特定于点对点的对象。一般情况下,使用 Session 对象。QueueSession 用于支持现有代码。使用 Session 对象可简化编程模型,并允许跨两个消息传送域使用事务。
不能使用 QueueSession 创建特定于发布/订阅域的对象。下列方法继承自 Session,但如果在 QueueSession 中使用它们,则必定抛出 IllegalStateException:
createDurableSubscribercreateTemporaryTopiccreateTopicunsubscribe
| version |
| |
| See also | javax.jms.Session, createQueueSession(boolean, int), getQueueSession() |
A QueueSession object provides methods for creating
QueueReceiver, QueueSender,
QueueBrowser, and TemporaryQueue objects.
If there are messages that have been received but not acknowledged
when a QueueSession terminates, these messages will be retained
and redelivered when a consumer next accesses the queue.
A QueueSession is used for creating Point-to-Point specific
objects. In general, use the Session object.
The QueueSession is used to support
existing code. Using the Session object simplifies the
programming model, and allows transactions to be used across the two
messaging domains.
A QueueSession cannot be used to create objects specific to the
publish/subscribe domain. The following methods inherit from
Session, but must throw an
IllegalStateException
if they are used from QueueSession:
createDurableSubscribercreateTemporaryTopiccreateTopicunsubscribe
- Version:
- 1.1 - April 2, 2002
- Author:
- Mark Hapner, Rich Burridge, Kate Stout
- See Also:
Session,QueueConnection.createQueueSession(boolean, int),XAQueueSession.getQueueSession()
| Field Summary |
|---|
| Fields inherited from interface javax.jms.Session |
|---|
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED |
| Method Summary | |
|---|---|
QueueBrowser |
createBrowser(Queue queue)
Creates a QueueBrowser object to peek at the messages on
the specified queue. |
QueueBrowser |
createBrowser(Queue queue,
String messageSelector)
Creates a QueueBrowser object to peek at the messages on
the specified queue using a message selector. |
Queue |
createQueue(String queueName)
Creates a queue identity given a Queue name. |
QueueReceiver |
createReceiver(Queue queue)
Creates a QueueReceiver object to receive messages from the
specified queue. |
QueueReceiver |
createReceiver(Queue queue,
String messageSelector)
Creates a QueueReceiver object to receive messages from the
specified queue using a message selector. |
QueueSender |
createSender(Queue queue)
Creates a QueueSender object to send messages to the
specified queue. |
TemporaryQueue |
createTemporaryQueue()
Creates a TemporaryQueue object. |
| Method Detail |
|---|
public Queue
createQueue(String queueName) throws JMSException
创建给定 Queue 名称的队列身份。
此工具供某些特殊情况使用,这些情况下客户端需要动态操作队列身份。它允许创建具有特定于提供者的名称的队列身份。依赖于此能力的客户端是不可移植的。
注意,此方法不用于创建物理队列。物理创建队列是一项管理任务,不应由 JMS API 发起。有一个例外是创建临时队列,它可以使用 createTemporaryQueue 方法实现。
| queueName |
此 Queue 的名称 |
| return |
具有给定名称的 Queue |
| Throws | JMSException: 如果会话由于某个内部错误无法创建队列。 |
createQueue
Queue createQueue(String queueName) throws JMSException
- Creates a queue identity given a
Queuename.This facility is provided for the rare cases where clients need to dynamically manipulate queue identity. It allows the creation of a queue identity with a provider-specific name. Clients that depend on this ability are not portable.
Note that this method is not for creating the physical queue. The physical creation of queues is an administrative task and is not to be initiated by the JMS API. The one exception is the creation of temporary queues, which is accomplished with the
createTemporaryQueuemethod. - Specified by:
createQueuein interfaceSession
- Parameters:
queueName- the name of thisQueue- Returns:
- a
Queuewith the given name - Throws:
JMSException- if the session fails to create a queue due to some internal error.
public QueueReceiver
createReceiver(Queue queue) throws JMSException
创建 QueueReceiver 对象从指定队列接收消息。
| queue |
要访问的 Queue |
| Throws | JMSException: 如果会话由于某个内部错误无法创建接收者。 |
| Throws | InvalidDestinationException: 如果指定了无效的队列。 |
createReceiver
QueueReceiver createReceiver(Queue queue) throws JMSException
- Creates a
QueueReceiverobject to receive messages from the specified queue. - Parameters:
queue- theQueueto access- Throws:
JMSException- if the session fails to create a receiver due to some internal error.InvalidDestinationException- if an invalid queue is specified.
public QueueReceiver
createReceiver(Queue queue, String messageSelector) throws JMSException
创建 QueueReceiver 对象从指定队列使用消息选择器接收消息。
| queue |
要访问的 Queue |
| messageSelector | 仅传送属性与消息选择器表达式相匹配的消息。值为 null 或空字符串表示该消息使用方没有消息选择器。 |
| Throws | JMSException: 如果会话由于某个内部错误无法创建接收者。 |
| Throws | InvalidDestinationException: 如果指定了无效的队列。 |
| Throws | InvalidSelectorException: 如果消息选择器无效。 |
createReceiver
QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException
- Creates a
QueueReceiverobject to receive messages from the specified queue using a message selector. - Parameters:
queue- theQueueto 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.- Throws:
JMSException- if the session fails to create a receiver due to some internal error.InvalidDestinationException- if an invalid queue is specified.InvalidSelectorException- if the message selector is invalid.
public QueueSender
createSender(Queue queue) throws JMSException
创建 QueueSender 对象以将消息发送到指定队列。
| queue |
要访问的 Queue;如果这是未标识的生成方,则为 null |
| Throws | JMSException: 如果会话由于某个内部错误无法创建发送者。 |
| Throws | InvalidDestinationException: 如果指定了无效的队列。 |
createSender
QueueSender createSender(Queue queue) throws JMSException
- Creates a
QueueSenderobject to send messages to the specified queue. - Parameters:
queue- theQueueto access, or null if this is an unidentified producer- Throws:
JMSException- if the session fails to create a sender due to some internal error.InvalidDestinationException- if an invalid queue is specified.
public QueueBrowser
createBrowser(Queue queue) throws JMSException
创建 QueueBrowser 对象以查看指定队列上的消息。
| queue |
要访问的 Queue |
| Throws | JMSException: 如果会话由于某个内部错误无法创建浏览器。 |
| Throws | InvalidDestinationException: 如果指定了无效的队列。 |
createBrowser
QueueBrowser createBrowser(Queue queue) throws JMSException
- Creates a
QueueBrowserobject to peek at the messages on the specified queue. - Specified by:
createBrowserin interfaceSession
- Parameters:
queue- theQueueto access- Throws:
JMSException- if the session fails to create a browser due to some internal error.InvalidDestinationException- if an invalid queue is specified.
public QueueBrowser
createBrowser(Queue queue, String messageSelector) throws JMSException
创建 QueueBrowser 对象以使用消息选择器查看指定队列上的消息。
| queue |
要访问的 Queue |
| messageSelector | 仅传送属性与消息选择器表达式相匹配的消息。值为 null 或空字符串表示该消息使用方没有消息选择器。 |
| Throws | JMSException: 如果会话由于某个内部错误无法创建浏览器。 |
| Throws | InvalidDestinationException: 如果指定了无效的队列。 |
| Throws | InvalidSelectorException: 如果消息选择器无效。 |
createBrowser
QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException
- Creates a
QueueBrowserobject to peek at the messages on the specified queue using a message selector. - Specified by:
createBrowserin interfaceSession
- Parameters:
queue- theQueueto 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.- Throws:
JMSException- if the session fails to create a browser due to some internal error.InvalidDestinationException- if an invalid queue is specified.InvalidSelectorException- if the message selector is invalid.
public TemporaryQueue
createTemporaryQueue() throws JMSException
创建 TemporaryQueue 对象。其生命周期将是 QueueConnection 的生命周期,除非提前删除该对象。
| return | 临时队列身份 |
| Throws | JMSException: 如果会话由于某个内部错误无法创建临时队列。 |
createTemporaryQueue
TemporaryQueue createTemporaryQueue() throws JMSException
- Creates a
TemporaryQueueobject. Its lifetime will be that of theQueueConnectionunless it is deleted earlier. - Specified by:
createTemporaryQueuein interfaceSession
- Returns:
- a temporary queue identity
- Throws:
JMSException- if the session fails to create a temporary queue 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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!