Interface QueueSession
-
- All Superinterfaces:
AutoCloseable,Runnable,Session
public interface QueueSession extends Session
AQueueSessionobject provides methods for creatingQueueReceiver,QueueSender,QueueBrowser, andTemporaryQueueobjects.If there are messages that have been received but not acknowledged when a
QueueSessionterminates, these messages will be retained and redelivered when a consumer next accesses the queue.A
QueueSessionis used for creating Point-to-Point specific objects. In general, use theSessionobject. TheQueueSessionis used to support existing code. Using theSessionobject simplifies the programming model, and allows transactions to be used across the two messaging domains.A
QueueSessioncannot be used to create objects specific to the publish/subscribe domain. The following methods inherit fromSession, but must throw anIllegalStateExceptionif they are used fromQueueSession:createDurableSubscribercreateDurableConsumercreateSharedConsumercreateSharedDurableConsumercreateTemporaryTopiccreateTopicunsubscribe
- Since:
- JMS 1.0
- Version:
- Jakarta Messaging 2.0
- See Also:
Session,QueueConnection.createQueueSession(boolean, int),XAQueueSession.getQueueSession()
-
-
Field Summary
-
Fields inherited from interface jakarta.jms.Session
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description QueueBrowsercreateBrowser(Queue queue)Creates aQueueBrowserobject to peek at the messages on the specified queue.QueueBrowsercreateBrowser(Queue queue, String messageSelector)Creates aQueueBrowserobject to peek at the messages on the specified queue using a message selector.QueuecreateQueue(String queueName)Creates a queue identity given aQueuename.QueueReceivercreateReceiver(Queue queue)Creates aQueueReceiverobject to receive messages from the specified queue.QueueReceivercreateReceiver(Queue queue, String messageSelector)Creates aQueueReceiverobject to receive messages from the specified queue using a message selector.QueueSendercreateSender(Queue queue)Creates aQueueSenderobject to send messages to the specified queue.TemporaryQueuecreateTemporaryQueue()Creates aTemporaryQueueobject.-
Methods inherited from interface jakarta.jms.Session
close, commit, createBytesMessage, createConsumer, createConsumer, createConsumer, createDurableConsumer, createDurableConsumer, createDurableSubscriber, createDurableSubscriber, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createProducer, createSharedConsumer, createSharedConsumer, createSharedDurableConsumer, createSharedDurableConsumer, createStreamMessage, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, getAcknowledgeMode, getMessageListener, getTransacted, recover, rollback, run, setMessageListener, unsubscribe
-
-
-
-
Method Detail
-
createQueue
Queue createQueue(String queueName) throws JMSException
Creates a queue identity given aQueuename.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
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.
-
createReceiver
QueueReceiver createReceiver(Queue queue) throws JMSException
Creates aQueueReceiverobject to receive messages from the specified queue.- Parameters:
queue- theQueueto access- Returns:
- A
QueueReceiverobject to receive messages from the specified queue - Throws:
JMSException- if the session fails to create a receiver due to some internal error.InvalidDestinationException- if an invalid queue is specified.
-
createReceiver
QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException
Creates aQueueReceiverobject 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.- Returns:
- A
QueueReceiverobject to receive messages from the specified queue - 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.
-
createSender
QueueSender createSender(Queue queue) throws JMSException
Creates aQueueSenderobject to send messages to the specified queue.- Parameters:
queue- theQueueto access, or null if this is an unidentified producer- Returns:
- A
QueueSenderobject to send messages to the specified queue. - Throws:
JMSException- if the session fails to create a sender due to some internal error.InvalidDestinationException- if an invalid queue is specified.
-
createBrowser
QueueBrowser createBrowser(Queue queue) throws JMSException
Creates aQueueBrowserobject to peek at the messages on the specified queue.- Specified by:
createBrowserin interfaceSession- Parameters:
queue- theQueueto access- Returns:
- A
QueueBrowserobject to peek at the messages. - Throws:
JMSException- if the session fails to create a browser due to some internal error.InvalidDestinationException- if an invalid queue is specified.
-
createBrowser
QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException
Creates aQueueBrowserobject 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.- Returns:
- A
QueueBrowserobject to peek at the messages on the specified queue. - 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.
-
createTemporaryQueue
TemporaryQueue createTemporaryQueue() throws JMSException
Creates aTemporaryQueueobject. 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.
-
-