|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.client.JmsSession | +--org.exolab.jms.client.JmsQueueSession | +--org.exolab.jms.client.JmsXAQueueSession
Client implementation of the javax.jms.XAQueueSession
interface.
Fields inherited from interface javax.jms.Session |
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED |
Method Summary | |
void |
acknowledgeMessage(javax.jms.Message message)
Acknowledge the specified message. |
protected void |
addConsumer(org.exolab.jms.client.JmsMessageConsumer consumer)
Add a consumer to the list of consumers managed by this session. |
protected void |
addMessage(javax.jms.Message message)
Add a message to the message cache. |
protected void |
addProducer(org.exolab.jms.client.JmsMessageProducer producer)
Add a producer to the list of producers managed by this session. |
protected long |
allocateConsumer(javax.jms.Destination destination,
java.lang.String selector,
boolean noLocal)
Creates a new message consumer, returning its identity. |
java.util.List |
browse(long consumerId,
int count)
Browse up to count messages. |
protected boolean |
checkForValidTemporaryDestination(JmsDestination destination)
This method checks the destination. |
void |
close()
Close the session. |
void |
commit()
Throws a TransactionInProgressException , since it should not
be called for an XASession object. |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue)
Creates a QueueBrowser object to peek at the messages on the
specified queue. |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue,
java.lang.String messageSelector)
Creates a QueueBrowser object to peek at the messages on the
specified queue using a message selector. |
javax.jms.BytesMessage |
createBytesMessage()
Creates a BytesMessage object. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination)
Creates a MessageConsumer for the specified destination. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
java.lang.String messageSelector)
Creates a MessageProducer to receive messages from the
specified destination, matching particular selection criteria |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
java.lang.String messageSelector,
boolean noLocal)
Creates a MessageConsumer to receive messages from the
specified destination, matching particular selection criteria. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name)
Creates a durable subscriber to the specified topic. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name,
java.lang.String messageSelector,
boolean noLocal)
This implementation always throws IllegalStateException , as
per section 4.11 of the JMS specification. |
javax.jms.MapMessage |
createMapMessage()
Creates a MapMessage object. |
javax.jms.Message |
createMessage()
Creates a Message object. |
javax.jms.ObjectMessage |
createObjectMessage()
Creates an ObjectMessage object. |
javax.jms.ObjectMessage |
createObjectMessage(java.io.Serializable object)
Creates an initialized ObjectMessage object. |
javax.jms.MessageProducer |
createProducer(javax.jms.Destination destination)
Creates a MessageProducer to send messages to the specified
destination. |
javax.jms.Queue |
createQueue(java.lang.String queueName)
Creates a queue identity given a Queue name. |
javax.jms.QueueReceiver |
createReceiver(javax.jms.Queue queue)
Create a receiver to receive messages from the specified queue. |
javax.jms.QueueReceiver |
createReceiver(javax.jms.Queue queue,
java.lang.String selector)
Create a receiver to receive messages from the specified queue. |
javax.jms.QueueSender |
createSender(javax.jms.Queue queue)
Create a sender to send messages to the specified queue. |
javax.jms.StreamMessage |
createStreamMessage()
Creates a StreamMessage object. |
javax.jms.TemporaryQueue |
createTemporaryQueue()
Creates a TemporaryQueue object. |
javax.jms.TemporaryTopic |
createTemporaryTopic()
This implementation always throws IllegalStateException , as
per section 4.11 of the JMS specification. |
javax.jms.TextMessage |
createTextMessage()
Creates a TextMessage object. |
javax.jms.TextMessage |
createTextMessage(java.lang.String text)
Creates an initialized TextMessage object. |
javax.jms.Topic |
createTopic(java.lang.String topicName)
This implementation always throws IllegalStateException , as
per section 4.11 of the JMS specification. |
protected void |
ensureOpen()
Verifies that the session isn't closed. |
int |
getAcknowledgeMode()
Returns the acknowledgement mode of the session. |
protected org.exolab.jms.client.JmsConnection |
getConnection()
Return a reference to the connection that created this session. |
javax.jms.MessageListener |
getMessageListener()
Returns the message listener associated with the session |
javax.jms.QueueSession |
getQueueSession()
Gets the queue session associated with this XAQueueSession . |
protected ServerSession |
getServerSession()
Returns the server session. |
javax.jms.Session |
getSession()
Gets the session associated with this XASession . |
boolean |
getTransacted()
Indicates whether the session is in transacted mode. |
javax.transaction.xa.XAResource |
getXAResource()
Returns an XA resource to the caller. |
protected boolean |
isClosed()
Check if the session is closed. |
boolean |
onMessage(MessageImpl message)
Deliver a message. |
void |
onMessageAvailable()
Inform the session that there is a message available for a synchronous consumer. |
MessageImpl |
receive(long consumerId,
long timeout)
Receive the next message that arrives within the specified timeout interval. |
MessageImpl |
receiveNoWait(long consumerId)
Receive the next message if one is immediately available. |
void |
recover()
Stop message delivery in this session, and restart sending messages with the oldest unacknowledged message |
protected void |
removeConsumer(org.exolab.jms.client.JmsMessageConsumer consumer)
Remove a consumer, deregistering it on the server. |
void |
removeMessageListener(org.exolab.jms.client.JmsMessageConsumer listener)
Remove a message listener |
protected void |
removeProducer(org.exolab.jms.client.JmsMessageProducer producer)
Remove the producer from the list of managed producers. |
void |
rollback()
Throws a TransactionInProgressException , since it should not
be called for an XASession object. |
void |
run()
Iterates through the list of messages added by an JmsConnectionConsumer , sending them to the registered listener |
protected void |
sendMessage(javax.jms.Message message)
Send the specified message to the server. |
void |
setAsynchronous(long consumerId,
boolean enable)
Enable or disable asynchronous message delivery for the specified consumer. |
void |
setMessageListener(org.exolab.jms.client.JmsMessageConsumer listener)
Set the message listener for a particular consumer. |
void |
setMessageListener(javax.jms.MessageListener listener)
Sets the session's message listener. |
void |
start()
This will start message delivery to this session. |
void |
stop()
This will stop message delivery to this session. |
void |
unsubscribe(java.lang.String name)
This implementation always throws IllegalStateException , as
per section 4.11 of the JMS specification. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.jms.Session |
close, createBrowser, createBrowser, createBytesMessage, createConsumer, createConsumer, createConsumer, createDurableSubscriber, createDurableSubscriber, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createProducer, createQueue, createStreamMessage, createTemporaryQueue, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, getAcknowledgeMode, getMessageListener, recover, run, setMessageListener, unsubscribe |
Methods inherited from interface javax.jms.QueueSession |
createBrowser, createBrowser, createQueue, createTemporaryQueue |
Method Detail |
public javax.jms.QueueSession getQueueSession()
XAQueueSession
.getQueueSession
in interface javax.jms.XAQueueSession
public javax.jms.Session getSession()
XASession
.getSession
in interface javax.jms.XASession
public javax.transaction.xa.XAResource getXAResource()
getXAResource
in interface javax.jms.XASession
public boolean getTransacted()
getTransacted
in interface javax.jms.XASession
getTransacted
in class org.exolab.jms.client.JmsSession
public void commit() throws javax.jms.JMSException
TransactionInProgressException
, since it should not
be called for an XASession
object.commit
in interface javax.jms.XASession
commit
in class org.exolab.jms.client.JmsSession
javax.jms.TransactionInProgressException
- if invokedpublic void rollback() throws javax.jms.JMSException
TransactionInProgressException
, since it should not
be called for an XASession
object.rollback
in interface javax.jms.XASession
rollback
in class org.exolab.jms.client.JmsSession
javax.jms.TransactionInProgressException
- if invokedpublic javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue) throws javax.jms.JMSException
createReceiver
in interface javax.jms.QueueSession
queue
- the queue to accessjavax.jms.JMSException
- if the receiver cannot be createdpublic javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue, java.lang.String selector) throws javax.jms.JMSException
createReceiver
in interface javax.jms.QueueSession
queue
- the queue to accessselector
- the message selector to filter messages. May be
null
javax.jms.JMSException
- if the receiver cannot be createdpublic javax.jms.QueueSender createSender(javax.jms.Queue queue) throws javax.jms.JMSException
createSender
in interface javax.jms.QueueSession
queue
- the queue to access, or null
if this is an
unidentified producerjavax.jms.JMSException
- if the sender can't be createdpublic javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException
IllegalStateException
, as
per section 4.11 of the JMS specification.createDurableSubscriber
in interface javax.jms.Session
createDurableSubscriber
in class org.exolab.jms.client.JmsSession
java.lang.IllegalStateException
- if invokedpublic javax.jms.Topic createTopic(java.lang.String topicName) throws javax.jms.JMSException
IllegalStateException
, as
per section 4.11 of the JMS specification.createTopic
in interface javax.jms.Session
createTopic
in class org.exolab.jms.client.JmsSession
java.lang.IllegalStateException
- if invokedpublic javax.jms.TemporaryTopic createTemporaryTopic() throws javax.jms.JMSException
IllegalStateException
, as
per section 4.11 of the JMS specification.createTemporaryTopic
in interface javax.jms.Session
createTemporaryTopic
in class org.exolab.jms.client.JmsSession
java.lang.IllegalStateException
- if invokedpublic void unsubscribe(java.lang.String name) throws javax.jms.JMSException
IllegalStateException
, as
per section 4.11 of the JMS specification.unsubscribe
in interface javax.jms.Session
unsubscribe
in class org.exolab.jms.client.JmsSession
java.lang.IllegalStateException
- if invokedpublic javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException
BytesMessage
object. A BytesMessage
object is used to send a message containing a stream of uninterpreted
bytes.createBytesMessage
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException
MapMessage
object. A MapMessage
object is used to send a self-defining set of name-value pairs, where
names are String
objects and values are primitive values in
the Java programming language.createMapMessage
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.Message createMessage() throws javax.jms.JMSException
Message
object. The Message
interface
is the root interface of all JMS messages. A Message
object
holds all the standard message header information. It can be sent when a
message containing only header information is sufficient.createMessage
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException
ObjectMessage
object. An ObjectMessage
object is used to send a message that contains a serializable Java
object.createObjectMessage
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable object) throws javax.jms.JMSException
ObjectMessage
object. An
ObjectMessage
object is used to send a message that contains
a serializable Java object.createObjectMessage
in interface javax.jms.Session
object
- the object to use to initialize this messagejavax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException
StreamMessage
object. A StreamMessage
object is used to send a self-defining stream of primitive values in the
Java programming language.createStreamMessage
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException
TextMessage
object. A TextMessage
object is used to send a message containing a String
object.createTextMessage
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public javax.jms.TextMessage createTextMessage(java.lang.String text) throws javax.jms.JMSException
TextMessage
object. A
TextMessage
object is used to send a message containing a
String
.createTextMessage
in interface javax.jms.Session
text
- the string used to initialize this messagejavax.jms.JMSException
- if the JMS provider fails to create this message due
to some internal error.public int getAcknowledgeMode() throws javax.jms.JMSException
getAcknowledgeMode
in interface javax.jms.Session
javax.jms.JMSException
- if the JMS provider fails to return the
acknowledgment mode due to some internal error.Connection.createSession(boolean, int)
public javax.jms.MessageProducer createProducer(javax.jms.Destination destination) throws javax.jms.JMSException
MessageProducer
to send messages to the specified
destination.createProducer
in interface javax.jms.Session
destination
- the Destination
to send to, or null if
this is a producer which does not have a specified
destination.javax.jms.JMSException
- if the session fails to create a
MessageProducer due to some internal
error.javax.jms.InvalidDestinationException
- if an invalid destination is
specified.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination) throws javax.jms.JMSException
MessageConsumer
for the specified destination.createConsumer
in interface javax.jms.Session
destination
- the Destination
to access.javax.jms.JMSException
- if the session fails to create a
consumer due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is
specified.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, java.lang.String messageSelector) throws javax.jms.JMSException
MessageProducer
to receive messages from the
specified destination, matching particular selection criteriacreateConsumer
in interface javax.jms.Session
destination
- the Destination
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.javax.jms.JMSException
- if the session fails to create a
MessageConsumer due to some internal
error.javax.jms.InvalidDestinationException
- if an invalid destination is
specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException
MessageConsumer
to receive messages from the
specified destination, matching particular selection criteria. This
method can specify whether messages published by its own connection
should be delivered to it, if the destination is a topic. In some
cases, a connection may both publish and subscribe to a topic. The
consumer noLocal
attribute allows a consumer to inhibit the
delivery of messages published by its own connection. The default value
for this attribute is false. The noLocal
value must be
supported by destinations that are topics.
createConsumer
in interface javax.jms.Session
destination
- the Destination
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.noLocal
- if true, and the destination is a topic, inhibits
the delivery of messages published by its own
connection. The behavior for noLocal
is not specified if the destination is a queue.javax.jms.JMSException
- if the session fails to create a
MessageConsumer due to some internal
error.javax.jms.InvalidDestinationException
- if an invalid destination is
specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.public javax.jms.Queue createQueue(java.lang.String queueName) throws javax.jms.JMSException
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 JMS API. The one exception is the creation of temporary
queues, which is accomplished with the createTemporaryQueue
method.
createQueue
in interface javax.jms.Session
queueName
- the name of this Queue
Queue
with the given namejavax.jms.JMSException
- if the session fails to create a queue due to some
internal error.public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException
If a client needs to receive all the messages published on a topic,
including the ones published while the subscriber is inactive, it uses a
durable TopicSubscriber
. The JMS provider retains a record
of this durable subscription and insures that all messages from the
topic's publishers are retained until they are acknowledged by this
durable subscriber or they have expired.
Sessions with durable subscribers must always provide the same client
identifier. In addition, each client must specify a name that uniquely
identifies (within client identifier) each durable subscription it
creates. Only one session at a time can have a TopicSubscriber
for a particular durable subscription.
A client can change an existing durable subscription by creating a
durable TopicSubscriber
with the same name and a new topic
and/or message selector. Changing a durable subscriber is equivalent to
unsubscribing (deleting) the old one and creating a new one.
In some cases, a connection may both publish and subscribe to a topic.
The subscriber noLocal
attribute allows a subscriber to
inhibit the delivery of messages published by its own connection. The
default value for this attribute is false.
createDurableSubscriber
in interface javax.jms.Session
topic
- the non-temporary Topic
to subscribe toname
- the name used to identify this subscriptionjavax.jms.JMSException
- if the session fails to create a
subscriber due to some internal
error.javax.jms.InvalidDestinationException
- if an invalid topic is specified.public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue) throws javax.jms.JMSException
QueueBrowser
object to peek at the messages on the
specified queue.createBrowser
in interface javax.jms.Session
queue
- the queue to accessjavax.jms.JMSException
- if the session fails to create a
browser due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is
specifiedpublic javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue, java.lang.String messageSelector) throws javax.jms.JMSException
QueueBrowser
object to peek at the messages on the
specified queue using a message selector.createBrowser
in interface javax.jms.Session
queue
- the queue
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.javax.jms.JMSException
- if the session fails to create a
browser due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is
specifiedjavax.jms.InvalidSelectorException
- if the message selector is invalid.public javax.jms.TemporaryQueue createTemporaryQueue() throws javax.jms.JMSException
TemporaryQueue
object. Its lifetime will be that
of the Connection
unless it is deleted earlier.createTemporaryQueue
in interface javax.jms.Session
javax.jms.JMSException
- if the session fails to create a temporary queue due
to some internal error.public void close() throws javax.jms.JMSException
null
when this session is closed.close
in interface javax.jms.Session
javax.jms.JMSException
- if the session can't be closedpublic void recover() throws javax.jms.JMSException
recover
in interface javax.jms.Session
javax.jms.JMSException
- if the session can't be recoveredpublic javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
getMessageListener
in interface javax.jms.Session
null
if no listener is registeredjavax.jms.JMSException
- if the session is closedpublic void setMessageListener(javax.jms.MessageListener listener) throws javax.jms.JMSException
setMessageListener
in interface javax.jms.Session
listener
- the session's message listenerjavax.jms.JMSException
- if the session is closedpublic void run()
JmsConnectionConsumer
, sending them to the registered listenerrun
in interface javax.jms.Session
public void setMessageListener(org.exolab.jms.client.JmsMessageConsumer listener) throws javax.jms.JMSException
listener
- the message listenerjavax.jms.JMSException
- if the listener can't be setpublic void removeMessageListener(org.exolab.jms.client.JmsMessageConsumer listener) throws javax.jms.JMSException
listener
- the message listener to removejavax.jms.JMSException
- if the listener can't be removedpublic void start() throws javax.jms.JMSException
javax.jms.JMSException
- if message delivery can't be startedpublic void stop() throws javax.jms.JMSException
javax.jms.JMSException
- if message delivery can't be stoppedpublic void acknowledgeMessage(javax.jms.Message message) throws javax.jms.JMSException
acknowledgeMessage
in interface MessageSessionIfc
message
- the message to acknowledgejavax.jms.JMSException
- if the message can't be acknowledgedpublic void setAsynchronous(long consumerId, boolean enable) throws javax.jms.JMSException
consumerId
- the consumer identifierenable
- true
to enable; false
to
disablejavax.jms.JMSException
- if message delivery cannot be enabled or disabledpublic boolean onMessage(MessageImpl message)
onMessage
in interface JmsMessageListener
message
- the message to delivertrue
if the message was delivered; otherwise
false
.public void onMessageAvailable()
onMessageAvailable
in interface JmsMessageListener
public MessageImpl receive(long consumerId, long timeout) throws javax.jms.JMSException
0
never
expires and the call blocks indefinitely.consumerId
- the consumer identifiertimeout
- the timeout interval, in millisecondsnull
if the timeout expires or the consumer concurrently closedjavax.jms.JMSException
- if the next message can't be receivedpublic MessageImpl receiveNoWait(long consumerId) throws javax.jms.JMSException
consumerId
- the consumer identifiernull
if one is not availablejavax.jms.JMSException
- if the next message can't be receivedpublic java.util.List browse(long consumerId, int count) throws javax.jms.JMSException
consumerId
- the consumer identifiercount
- the maximum number of messages to receiveMessageImpl
instancesjavax.jms.JMSException
- for any JMS errorprotected void sendMessage(javax.jms.Message message) throws javax.jms.JMSException
message
- the message to sendjavax.jms.JMSException
- if the message can't be sentprotected ServerSession getServerSession()
protected org.exolab.jms.client.JmsConnection getConnection()
protected long allocateConsumer(javax.jms.Destination destination, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
destination
- the destination to accessselector
- the message selector. May be null
noLocal
- if true, and the destination is a topic, inhibits the
delivery of messages published by its own connection.
The behavior for noLocal
is not specified
if the destination is a queue.javax.jms.JMSException
- if the session fails to create a
MessageConsumer due to some internal
error.javax.jms.InvalidDestinationException
- if an invalid destination is
specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.protected boolean checkForValidTemporaryDestination(JmsDestination destination)
destination
- the destination to checktrue
if the destination is validprotected void addConsumer(org.exolab.jms.client.JmsMessageConsumer consumer)
consumer
- the consumer to addprotected void removeConsumer(org.exolab.jms.client.JmsMessageConsumer consumer) throws javax.jms.JMSException
consumer
- the consumer to removejavax.jms.JMSException
- if removal failsprotected void addProducer(org.exolab.jms.client.JmsMessageProducer producer)
producer
- the producer to addprotected void removeProducer(org.exolab.jms.client.JmsMessageProducer producer)
producer
- the producer to removeprotected final boolean isClosed()
true
if the session is closedprotected void addMessage(javax.jms.Message message)
message
- the message to add.protected void ensureOpen() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
- if the session is closed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |