org.exolab.jms.client
Class JmsXAQueueSession

java.lang.Object
  |
  +--org.exolab.jms.client.JmsSession
        |
        +--org.exolab.jms.client.JmsQueueSession
              |
              +--org.exolab.jms.client.JmsXAQueueSession
All Implemented Interfaces:
JmsMessageListener, MessageSessionIfc, javax.jms.QueueSession, java.lang.Runnable, javax.jms.Session, javax.jms.XAQueueSession, javax.jms.XASession

public class JmsXAQueueSession
extends org.exolab.jms.client.JmsQueueSession
implements javax.jms.XAQueueSession

Client implementation of the javax.jms.XAQueueSession interface.

Version:
$Revision: 1.2 $ $Date: 2005/03/18 03:36:37 $
Author:
Jim Alateras, Tim Anderson

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

getQueueSession

public javax.jms.QueueSession getQueueSession()
Gets the queue session associated with this XAQueueSession.
Specified by:
getQueueSession in interface javax.jms.XAQueueSession
Returns:
the queue session object

getSession

public javax.jms.Session getSession()
Gets the session associated with this XASession.
Specified by:
getSession in interface javax.jms.XASession
Returns:
the session object

getXAResource

public javax.transaction.xa.XAResource getXAResource()
Returns an XA resource to the caller.
Specified by:
getXAResource in interface javax.jms.XASession
Returns:
an XA resource to the caller

getTransacted

public boolean getTransacted()
Indicates whether the session is in transacted mode.
Specified by:
getTransacted in interface javax.jms.XASession
Overrides:
getTransacted in class org.exolab.jms.client.JmsSession
Returns:
true

commit

public void commit()
            throws javax.jms.JMSException
Throws a TransactionInProgressException, since it should not be called for an XASession object.
Specified by:
commit in interface javax.jms.XASession
Overrides:
commit in class org.exolab.jms.client.JmsSession
Throws:
javax.jms.TransactionInProgressException - if invoked

rollback

public void rollback()
              throws javax.jms.JMSException
Throws a TransactionInProgressException, since it should not be called for an XASession object.
Specified by:
rollback in interface javax.jms.XASession
Overrides:
rollback in class org.exolab.jms.client.JmsSession
Throws:
javax.jms.TransactionInProgressException - if invoked

createReceiver

public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue)
                                       throws javax.jms.JMSException
Create a receiver to receive messages from the specified queue.
Specified by:
createReceiver in interface javax.jms.QueueSession
Parameters:
queue - the queue to access
Returns:
the new receiver
Throws:
javax.jms.JMSException - if the receiver cannot be created

createReceiver

public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue,
                                              java.lang.String selector)
                                       throws javax.jms.JMSException
Create a receiver to receive messages from the specified queue.
Specified by:
createReceiver in interface javax.jms.QueueSession
Parameters:
queue - the queue to access
selector - the message selector to filter messages. May be null
Returns:
the new receiver
Throws:
javax.jms.JMSException - if the receiver cannot be created

createSender

public javax.jms.QueueSender createSender(javax.jms.Queue queue)
                                   throws javax.jms.JMSException
Create a sender to send messages to the specified queue.
Specified by:
createSender in interface javax.jms.QueueSession
Parameters:
queue - the queue to access, or null if this is an unidentified producer
Returns:
the new sender
Throws:
javax.jms.JMSException - if the sender can't be created

createDurableSubscriber

public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                         java.lang.String name,
                                                         java.lang.String messageSelector,
                                                         boolean noLocal)
                                                  throws javax.jms.JMSException
This implementation always throws IllegalStateException, as per section 4.11 of the JMS specification.
Specified by:
createDurableSubscriber in interface javax.jms.Session
Overrides:
createDurableSubscriber in class org.exolab.jms.client.JmsSession
Throws:
java.lang.IllegalStateException - if invoked

createTopic

public javax.jms.Topic createTopic(java.lang.String topicName)
                            throws javax.jms.JMSException
This implementation always throws IllegalStateException, as per section 4.11 of the JMS specification.
Specified by:
createTopic in interface javax.jms.Session
Overrides:
createTopic in class org.exolab.jms.client.JmsSession
Throws:
java.lang.IllegalStateException - if invoked

createTemporaryTopic

public javax.jms.TemporaryTopic createTemporaryTopic()
                                              throws javax.jms.JMSException
This implementation always throws IllegalStateException, as per section 4.11 of the JMS specification.
Specified by:
createTemporaryTopic in interface javax.jms.Session
Overrides:
createTemporaryTopic in class org.exolab.jms.client.JmsSession
Throws:
java.lang.IllegalStateException - if invoked

unsubscribe

public void unsubscribe(java.lang.String name)
                 throws javax.jms.JMSException
This implementation always throws IllegalStateException, as per section 4.11 of the JMS specification.
Specified by:
unsubscribe in interface javax.jms.Session
Overrides:
unsubscribe in class org.exolab.jms.client.JmsSession
Throws:
java.lang.IllegalStateException - if invoked

createBytesMessage

public javax.jms.BytesMessage createBytesMessage()
                                          throws javax.jms.JMSException
Creates a BytesMessage object. A BytesMessage object is used to send a message containing a stream of uninterpreted bytes.
Specified by:
createBytesMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createMapMessage

public javax.jms.MapMessage createMapMessage()
                                      throws javax.jms.JMSException
Creates a 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.
Specified by:
createMapMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createMessage

public javax.jms.Message createMessage()
                                throws javax.jms.JMSException
Creates a 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.
Specified by:
createMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createObjectMessage

public javax.jms.ObjectMessage createObjectMessage()
                                            throws javax.jms.JMSException
Creates an ObjectMessage object. An ObjectMessage object is used to send a message that contains a serializable Java object.
Specified by:
createObjectMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createObjectMessage

public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable object)
                                            throws javax.jms.JMSException
Creates an initialized ObjectMessage object. An ObjectMessage object is used to send a message that contains a serializable Java object.
Specified by:
createObjectMessage in interface javax.jms.Session
Parameters:
object - the object to use to initialize this message
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createStreamMessage

public javax.jms.StreamMessage createStreamMessage()
                                            throws javax.jms.JMSException
Creates a StreamMessage object. A StreamMessage object is used to send a self-defining stream of primitive values in the Java programming language.
Specified by:
createStreamMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createTextMessage

public javax.jms.TextMessage createTextMessage()
                                        throws javax.jms.JMSException
Creates a TextMessage object. A TextMessage object is used to send a message containing a String object.
Specified by:
createTextMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

createTextMessage

public javax.jms.TextMessage createTextMessage(java.lang.String text)
                                        throws javax.jms.JMSException
Creates an initialized TextMessage object. A TextMessage object is used to send a message containing a String.
Specified by:
createTextMessage in interface javax.jms.Session
Parameters:
text - the string used to initialize this message
Throws:
javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.

getAcknowledgeMode

public int getAcknowledgeMode()
                       throws javax.jms.JMSException
Returns the acknowledgement mode of the session. The acknowledgement mode is set at the time that the session is created. If the session is transacted, the acknowledgement mode is ignored.
Specified by:
getAcknowledgeMode in interface javax.jms.Session
Returns:
If the session is not transacted, returns the current acknowledgement mode for the session. If the session is transacted, returns SESSION_TRANSACTED.
Throws:
javax.jms.JMSException - if the JMS provider fails to return the acknowledgment mode due to some internal error.
See Also:
Connection.createSession(boolean, int)

createProducer

public javax.jms.MessageProducer createProducer(javax.jms.Destination destination)
                                         throws javax.jms.JMSException
Creates a MessageProducer to send messages to the specified destination.
Specified by:
createProducer in interface javax.jms.Session
Parameters:
destination - the Destination to send to, or null if this is a producer which does not have a specified destination.
Throws:
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.

createConsumer

public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination)
                                         throws javax.jms.JMSException
Creates a MessageConsumer for the specified destination.
Specified by:
createConsumer in interface javax.jms.Session
Parameters:
destination - the Destination to access.
Throws:
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.

createConsumer

public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
                                                java.lang.String messageSelector)
                                         throws javax.jms.JMSException
Creates a MessageProducer to receive messages from the specified destination, matching particular selection criteria
Specified by:
createConsumer in interface javax.jms.Session
Parameters:
destination - the Destination 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.
Throws:
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.

createConsumer

public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
                                                java.lang.String messageSelector,
                                                boolean noLocal)
                                         throws javax.jms.JMSException
Creates a 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.

Specified by:
createConsumer in interface javax.jms.Session
Parameters:
destination - the Destination 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.
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.
Throws:
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.

createQueue

public javax.jms.Queue createQueue(java.lang.String queueName)
                            throws javax.jms.JMSException
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 JMS API. The one exception is the creation of temporary queues, which is accomplished with the createTemporaryQueue method.

Specified by:
createQueue in interface javax.jms.Session
Parameters:
queueName - the name of this Queue
Returns:
a Queue with the given name
Throws:
javax.jms.JMSException - if the session fails to create a queue due to some internal error.

createDurableSubscriber

public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                         java.lang.String name)
                                                  throws javax.jms.JMSException
Creates a durable subscriber to the specified topic.

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.

Specified by:
createDurableSubscriber in interface javax.jms.Session
Parameters:
topic - the non-temporary Topic to subscribe to
name - the name used to identify this subscription
Throws:
javax.jms.JMSException - if the session fails to create a subscriber due to some internal error.
javax.jms.InvalidDestinationException - if an invalid topic is specified.

createBrowser

public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
                                     throws javax.jms.JMSException
Creates a QueueBrowser object to peek at the messages on the specified queue.
Specified by:
createBrowser in interface javax.jms.Session
Parameters:
queue - the queue to access
Throws:
javax.jms.JMSException - if the session fails to create a browser due to some internal error.
javax.jms.InvalidDestinationException - if an invalid destination is specified

createBrowser

public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue,
                                            java.lang.String messageSelector)
                                     throws javax.jms.JMSException
Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector.
Specified by:
createBrowser in interface javax.jms.Session
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.
Throws:
javax.jms.JMSException - if the session fails to create a browser due to some internal error.
javax.jms.InvalidDestinationException - if an invalid destination is specified
javax.jms.InvalidSelectorException - if the message selector is invalid.

createTemporaryQueue

public javax.jms.TemporaryQueue createTemporaryQueue()
                                              throws javax.jms.JMSException
Creates a TemporaryQueue object. Its lifetime will be that of the Connection unless it is deleted earlier.
Specified by:
createTemporaryQueue in interface javax.jms.Session
Returns:
a temporary queue identity
Throws:
javax.jms.JMSException - if the session fails to create a temporary queue due to some internal error.

close

public void close()
           throws javax.jms.JMSException
Close the session. This call will block until a receive or message listener in progress has completed. A blocked message consumer receive call returns null when this session is closed.
Specified by:
close in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the session can't be closed

recover

public void recover()
             throws javax.jms.JMSException
Stop message delivery in this session, and restart sending messages with the oldest unacknowledged message
Specified by:
recover in interface javax.jms.Session
Throws:
javax.jms.JMSException - if the session can't be recovered

getMessageListener

public javax.jms.MessageListener getMessageListener()
                                             throws javax.jms.JMSException
Returns the message listener associated with the session
Specified by:
getMessageListener in interface javax.jms.Session
Returns:
the message listener associated with the session, or null if no listener is registered
Throws:
javax.jms.JMSException - if the session is closed

setMessageListener

public void setMessageListener(javax.jms.MessageListener listener)
                        throws javax.jms.JMSException
Sets the session's message listener.
Specified by:
setMessageListener in interface javax.jms.Session
Parameters:
listener - the session's message listener
Throws:
javax.jms.JMSException - if the session is closed

run

public void run()
Iterates through the list of messages added by an JmsConnectionConsumer, sending them to the registered listener
Specified by:
run in interface javax.jms.Session

setMessageListener

public void setMessageListener(org.exolab.jms.client.JmsMessageConsumer listener)
                        throws javax.jms.JMSException
Set the message listener for a particular consumer.

If a listener is already registered for the consumer, it will be automatically overwritten

Parameters:
listener - the message listener
Throws:
javax.jms.JMSException - if the listener can't be set

removeMessageListener

public void removeMessageListener(org.exolab.jms.client.JmsMessageConsumer listener)
                           throws javax.jms.JMSException
Remove a message listener
Parameters:
listener - the message listener to remove
Throws:
javax.jms.JMSException - if the listener can't be removed

start

public void start()
           throws javax.jms.JMSException
This will start message delivery to this session. If message delivery has already started, or the session is currently being closed then this is a no-op.
Throws:
javax.jms.JMSException - if message delivery can't be started

stop

public void stop()
          throws javax.jms.JMSException
This will stop message delivery to this session. If message delivery has already stoped then this is a no-op.
Throws:
javax.jms.JMSException - if message delivery can't be stopped

acknowledgeMessage

public void acknowledgeMessage(javax.jms.Message message)
                        throws javax.jms.JMSException
Acknowledge the specified message. This is only applicable for CLIENT_ACKNOWLEDGE sessions. For other session types, the request is ignored.

Acking a message automatically acks all those that have come before it.

Specified by:
acknowledgeMessage in interface MessageSessionIfc
Parameters:
message - the message to acknowledge
Throws:
javax.jms.JMSException - if the message can't be acknowledged

setAsynchronous

public void setAsynchronous(long consumerId,
                            boolean enable)
                     throws javax.jms.JMSException
Enable or disable asynchronous message delivery for the specified consumer.
Parameters:
consumerId - the consumer identifier
enable - true to enable; false to disable
Throws:
javax.jms.JMSException - if message delivery cannot be enabled or disabled

onMessage

public boolean onMessage(MessageImpl message)
Deliver a message.
Specified by:
onMessage in interface JmsMessageListener
Parameters:
message - the message to deliver
Returns:
true if the message was delivered; otherwise false.

onMessageAvailable

public void onMessageAvailable()
Inform the session that there is a message available for a synchronous consumer.
Specified by:
onMessageAvailable in interface JmsMessageListener

receive

public MessageImpl receive(long consumerId,
                           long timeout)
                    throws javax.jms.JMSException
Receive the next message that arrives within the specified timeout interval. This call blocks until a message arrives, the timeout expires, or this message consumer is closed. A timeout of 0 never expires and the call blocks indefinitely.
Parameters:
consumerId - the consumer identifier
timeout - the timeout interval, in milliseconds
Returns:
the next message produced for the consumer, or null if the timeout expires or the consumer concurrently closed
Throws:
javax.jms.JMSException - if the next message can't be received

receiveNoWait

public MessageImpl receiveNoWait(long consumerId)
                          throws javax.jms.JMSException
Receive the next message if one is immediately available.
Parameters:
consumerId - the consumer identifier
Returns:
the next message produced for this consumer, or null if one is not available
Throws:
javax.jms.JMSException - if the next message can't be received

browse

public java.util.List browse(long consumerId,
                             int count)
                      throws javax.jms.JMSException
Browse up to count messages.
Parameters:
consumerId - the consumer identifier
count - the maximum number of messages to receive
Returns:
a list of MessageImpl instances
Throws:
javax.jms.JMSException - for any JMS error

sendMessage

protected void sendMessage(javax.jms.Message message)
                    throws javax.jms.JMSException
Send the specified message to the server.
Parameters:
message - the message to send
Throws:
javax.jms.JMSException - if the message can't be sent

getServerSession

protected ServerSession getServerSession()
Returns the server session.
Returns:
the server session

getConnection

protected org.exolab.jms.client.JmsConnection getConnection()
Return a reference to the connection that created this session.
Returns:
the owning connection

allocateConsumer

protected long allocateConsumer(javax.jms.Destination destination,
                                java.lang.String selector,
                                boolean noLocal)
                         throws javax.jms.JMSException
Creates a new message consumer, returning its identity.
Parameters:
destination - the destination to access
selector - 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.
Throws:
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.

checkForValidTemporaryDestination

protected boolean checkForValidTemporaryDestination(JmsDestination destination)
This method checks the destination. If the destination is not temporary then return true. If it is a temporary destination and it is owned by this session's connection then it returns true. If it is a tmeporary destination and it is owned by another connection then it returns false
Parameters:
destination - the destination to check
Returns:
true if the destination is valid

addConsumer

protected void addConsumer(org.exolab.jms.client.JmsMessageConsumer consumer)
Add a consumer to the list of consumers managed by this session.
Parameters:
consumer - the consumer to add

removeConsumer

protected void removeConsumer(org.exolab.jms.client.JmsMessageConsumer consumer)
                       throws javax.jms.JMSException
Remove a consumer, deregistering it on the server.
Parameters:
consumer - the consumer to remove
Throws:
javax.jms.JMSException - if removal fails

addProducer

protected void addProducer(org.exolab.jms.client.JmsMessageProducer producer)
Add a producer to the list of producers managed by this session.
Parameters:
producer - the producer to add

removeProducer

protected void removeProducer(org.exolab.jms.client.JmsMessageProducer producer)
Remove the producer from the list of managed producers.
Parameters:
producer - the producer to remove

isClosed

protected final boolean isClosed()
Check if the session is closed.
Returns:
true if the session is closed

addMessage

protected void addMessage(javax.jms.Message message)
Add a message to the message cache. This message will be processed when the run() method is called.
Parameters:
message - the message to add.

ensureOpen

protected void ensureOpen()
                   throws javax.jms.IllegalStateException
Verifies that the session isn't closed.
Throws:
javax.jms.IllegalStateException - if the session is closed


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.