Top Description Fields Methods
jakarta.jms

public Interface QueueSession

extends Session

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:

Since
JMS 1.0
Version
Jakarta Messaging 2.0
See Also
jakarta.jms.Session, jakarta.jms.QueueConnection#createQueueSession(boolean, int), jakarta.jms.XAQueueSession#getQueueSession()

Field Summary

Inherited from jakarta.jms.Session:
AUTO_ACKNOWLEDGECLIENT_ACKNOWLEDGEDUPS_OK_ACKNOWLEDGESESSION_TRANSACTED

Method Summary

Modifier and TypeMethod and Description
public QueueBrowser

Returns:

A QueueBrowser object to peek at the messages.
createBrowser
(Queue
the Queue to access
queue
)

Redeclares jakarta.jms.Session.createBrowser.

Creates a QueueBrowser object to peek at the messages on the specified queue.

public QueueBrowser

Returns:

A QueueBrowser object to peek at the messages on the specified queue.
createBrowser
(Queue
the Queue to access
queue
,
String
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.
messageSelector
)

Redeclares jakarta.jms.Session.createBrowser.

Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector.

public Queue

Returns:

a Queue with the given name
createQueue
(String
the name of this Queue
queueName
)

Redeclares jakarta.jms.Session.createQueue.

Creates a queue identity given a Queue name.

public QueueReceiver

Returns:

A QueueReceiver object to receive messages from the specified queue
createReceiver
(Queue
the Queue to access
queue
)

Creates a QueueReceiver object to receive messages from the specified queue.

public QueueReceiver

Returns:

A QueueReceiver object to receive messages from the specified queue
createReceiver
(Queue
the Queue to access
queue
,
String
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.
messageSelector
)

Creates a QueueReceiver object to receive messages from the specified queue using a message selector.

public QueueSender

Returns:

A QueueSender object to send messages to the specified queue.
createSender
(Queue
the Queue to access, or null if this is an unidentified producer
queue
)

Creates a QueueSender object to send messages to the specified queue.

public TemporaryQueue

Returns:

a temporary queue identity
createTemporaryQueue
()

Redeclares jakarta.jms.Session.createTemporaryQueue.

Creates a TemporaryQueue object.

Inherited from jakarta.jms.Session:
closecommitcreateBytesMessagecreateConsumercreateConsumercreateConsumercreateDurableConsumercreateDurableConsumercreateDurableSubscribercreateDurableSubscribercreateMapMessagecreateMessagecreateObjectMessagecreateObjectMessagecreateProducercreateSharedConsumercreateSharedConsumercreateSharedDurableConsumercreateSharedDurableConsumercreateStreamMessagecreateTemporaryTopiccreateTextMessagecreateTextMessagecreateTopicgetAcknowledgeModegetMessageListenergetTransactedrecoverrollbackrunsetMessageListenerunsubscribe

Method Detail

createBrowserback to summary
public QueueBrowser createBrowser(Queue queue) throws JMSException

Redeclares jakarta.jms.Session.createBrowser.

Creates a QueueBrowser object to peek at the messages on the specified queue.

Parameters
queue:Queue

the Queue to access

Returns:QueueBrowser

A QueueBrowser object to peek at the messages.

Annotations
@Override
Exceptions
JMSException:
if the session fails to create a browser due to some internal error.
InvalidDestinationException:
if an invalid queue is specified.
createBrowserback to summary
public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException

Redeclares jakarta.jms.Session.createBrowser.

Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector.

Parameters
queue:Queue

the Queue to access

messageSelector:String

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.

Returns:QueueBrowser

A QueueBrowser object to peek at the messages on the specified queue.

Annotations
@Override
Exceptions
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.
createQueueback to summary
public Queue createQueue(String queueName) throws JMSException

Redeclares jakarta.jms.Session.createQueue.

Creates a queue identity given a Queue name.

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 Jakarta Messaging API. The one exception is the creation of temporary queues, which is accomplished with the createTemporaryQueue method.

Parameters
queueName:String

the name of this Queue

Returns:Queue

a Queue with the given name

Annotations
@Override
Exceptions
JMSException:
if the session fails to create a queue due to some internal error.
createReceiverback to summary
public QueueReceiver createReceiver(Queue queue) throws JMSException

Creates a QueueReceiver object to receive messages from the specified queue.

Parameters
queue:Queue

the Queue to access

Returns:QueueReceiver

A QueueReceiver object to receive messages from the specified queue

Exceptions
JMSException:
if the session fails to create a receiver due to some internal error.
InvalidDestinationException:
if an invalid queue is specified.
createReceiverback to summary
public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException

Creates a QueueReceiver object to receive messages from the specified queue using a message selector.

Parameters
queue:Queue

the Queue to access

messageSelector:String

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.

Returns:QueueReceiver

A QueueReceiver object to receive messages from the specified queue

Exceptions
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.
createSenderback to summary
public QueueSender createSender(Queue queue) throws JMSException

Creates a QueueSender object to send messages to the specified queue.

Parameters
queue:Queue

the Queue to access, or null if this is an unidentified producer

Returns:QueueSender

A QueueSender object to send messages to the specified queue.

Exceptions
JMSException:
if the session fails to create a sender due to some internal error.
InvalidDestinationException:
if an invalid queue is specified.
createTemporaryQueueback to summary
public TemporaryQueue createTemporaryQueue() throws JMSException

Redeclares jakarta.jms.Session.createTemporaryQueue.

Creates a TemporaryQueue object. Its lifetime will be that of the QueueConnection unless it is deleted earlier.

Returns:TemporaryQueue

a temporary queue identity

Annotations
@Override
Exceptions
JMSException:
if the session fails to create a temporary queue due to some internal error.