org.apache.commons.messenger
Class MessengerSession

java.lang.Object
  extended by org.apache.commons.messenger.MessengerSession

public class MessengerSession
extends Object

MessengerSession represents all the local information for a single thread.

Version:
$Revision: 155459 $
Author:
James Strachan

Constructor Summary
MessengerSession(MessengerSupport messenger, SessionFactory sessionFactory)
           
 
Method Summary
 void close()
          Closes any sessions or producers open
protected  javax.jms.Session createSession()
          Factory method to create a new JMS Session
protected  javax.jms.Destination createTemporaryDestination()
          Factory method to create a new temporary destination
 javax.jms.Session getListenerSession()
           
 javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
           
 javax.jms.QueueRequestor getQueueRequestor(javax.jms.QueueSession session, javax.jms.Queue destination)
           
 javax.jms.MessageConsumer getReplyToConsumer()
           
protected  javax.jms.Destination getReplyToDestination()
           
protected  Map getRequestorsMap()
           
 javax.jms.Session getSession()
           
 SessionFactory getSessionFactory()
           
 javax.jms.TopicRequestor getTopicRequestor(javax.jms.TopicSession session, javax.jms.Topic destination)
           
 boolean isTopic()
           
 void setReplyToConsumer(javax.jms.MessageConsumer replyToConsumer)
           
protected  void setReplyToDestination(javax.jms.Destination replyToDestination)
          Sets the reply to destination to use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessengerSession

public MessengerSession(MessengerSupport messenger,
                        SessionFactory sessionFactory)
Method Detail

getSessionFactory

public SessionFactory getSessionFactory()

close

public void close()
           throws javax.jms.JMSException
Closes any sessions or producers open

Throws:
javax.jms.JMSException

getSession

public javax.jms.Session getSession()
                             throws javax.jms.JMSException
Returns:
the JMS Session for this thread for synchronous mode
Throws:
javax.jms.JMSException

getListenerSession

public javax.jms.Session getListenerSession()
                                     throws javax.jms.JMSException
Returns:
the JMS Session for this thread for asynchronous mode
Throws:
javax.jms.JMSException

getReplyToConsumer

public javax.jms.MessageConsumer getReplyToConsumer()
                                             throws javax.jms.JMSException
Returns:
the MessageConsumer for the ReplyTo Destination for this thread
Throws:
javax.jms.JMSException

setReplyToConsumer

public void setReplyToConsumer(javax.jms.MessageConsumer replyToConsumer)

getMessageProducer

public javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
                                             throws javax.jms.JMSException
Returns:
the MessageProducer for the given destination.
Throws:
javax.jms.JMSException

getReplyToDestination

protected javax.jms.Destination getReplyToDestination()
                                               throws javax.jms.JMSException
Returns:
the reply to destination (a temporary queue) used to reply to this thread and session
Throws:
javax.jms.JMSException

setReplyToDestination

protected void setReplyToDestination(javax.jms.Destination replyToDestination)
                              throws javax.jms.JMSException
Sets the reply to destination to use

Throws:
javax.jms.JMSException

getTopicRequestor

public javax.jms.TopicRequestor getTopicRequestor(javax.jms.TopicSession session,
                                                  javax.jms.Topic destination)
                                           throws javax.jms.JMSException
Returns:
either a cached TopicRequestor or creates a new one
Throws:
javax.jms.JMSException

getQueueRequestor

public javax.jms.QueueRequestor getQueueRequestor(javax.jms.QueueSession session,
                                                  javax.jms.Queue destination)
                                           throws javax.jms.JMSException
Returns:
either a cached QueueRequestor or creates a new one
Throws:
javax.jms.JMSException

isTopic

public boolean isTopic()
                throws javax.jms.JMSException
Throws:
javax.jms.JMSException

createSession

protected javax.jms.Session createSession()
                                   throws javax.jms.JMSException
Factory method to create a new JMS Session

Throws:
javax.jms.JMSException

createTemporaryDestination

protected javax.jms.Destination createTemporaryDestination()
                                                    throws javax.jms.JMSException
Factory method to create a new temporary destination

Throws:
javax.jms.JMSException

getRequestorsMap

protected Map getRequestorsMap()
Returns:
the map of requestors, indexed by destination. The Map will be lazily constructed


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.