org.apache.activemq.ra
Class ManagedConnectionProxy

java.lang.Object
  extended by org.apache.activemq.ra.ManagedConnectionProxy
All Implemented Interfaces:
Connection, ExceptionListener, QueueConnection, TopicConnection

public class ManagedConnectionProxy
extends Object
implements Connection, QueueConnection, TopicConnection, ExceptionListener

Acts as a pass through proxy for a JMS Connection object. It intercepts events that are of interest of the ActiveMQManagedConnection.


Constructor Summary
ManagedConnectionProxy(ActiveMQManagedConnection managedConnection)
           
 
Method Summary
 void cleanup()
          Called by the ActiveMQManagedConnection to invalidate this proxy.
 void close()
          Used to let the ActiveMQManagedConnection that this connection handel is not needed by the app.
 ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages)
           
 ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages)
           
 ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool, int maxMessages)
           
 ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages)
           
 QueueSession createQueueSession(boolean transacted, int acknowledgeMode)
           
 Session createSession(boolean transacted, int acknowledgeMode)
           
 TopicSession createTopicSession(boolean transacted, int acknowledgeMode)
           
 String getClientID()
           
 ExceptionListener getExceptionListener()
           
 ActiveMQManagedConnection getManagedConnection()
           
 ConnectionMetaData getMetaData()
           
 void onException(JMSException e)
           
protected  void sessionClosed(ManagedSessionProxy session)
           
 void setClientID(String clientID)
          Sets client id on delegate
 void setExceptionListener(ExceptionListener listener)
          sets exception listener on delegate
 void setUseSharedTxContext(boolean enable)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedConnectionProxy

public ManagedConnectionProxy(ActiveMQManagedConnection managedConnection)
Method Detail

close

public void close()
           throws JMSException
Used to let the ActiveMQManagedConnection that this connection handel is not needed by the app.

Specified by:
close in interface Connection
Throws:
JMSException

cleanup

public void cleanup()
Called by the ActiveMQManagedConnection to invalidate this proxy.


createSession

public Session createSession(boolean transacted,
                             int acknowledgeMode)
                      throws JMSException
Specified by:
createSession in interface Connection
Parameters:
transacted - Whether session is transacted
acknowledgeMode - session acknowledge mode
Returns:
session proxy
Throws:
JMSException - on error

sessionClosed

protected void sessionClosed(ManagedSessionProxy session)

setUseSharedTxContext

public void setUseSharedTxContext(boolean enable)
                           throws JMSException
Throws:
JMSException

createQueueSession

public QueueSession createQueueSession(boolean transacted,
                                       int acknowledgeMode)
                                throws JMSException
Specified by:
createQueueSession in interface QueueConnection
Parameters:
transacted - Whether session is transacted
acknowledgeMode - session acknowledge mode
Returns:
session proxy
Throws:
JMSException - on error

createTopicSession

public TopicSession createTopicSession(boolean transacted,
                                       int acknowledgeMode)
                                throws JMSException
Specified by:
createTopicSession in interface TopicConnection
Parameters:
transacted - Whether session is transacted
acknowledgeMode - session acknowledge mode
Returns:
session proxy
Throws:
JMSException - on error

getClientID

public String getClientID()
                   throws JMSException
Specified by:
getClientID in interface Connection
Returns:
client id from delegate
Throws:
JMSException

getExceptionListener

public ExceptionListener getExceptionListener()
                                       throws JMSException
Specified by:
getExceptionListener in interface Connection
Returns:
exception listener from delegate
Throws:
JMSException

getMetaData

public ConnectionMetaData getMetaData()
                               throws JMSException
Specified by:
getMetaData in interface Connection
Returns:
connection metadata from delegate
Throws:
JMSException

setClientID

public void setClientID(String clientID)
                 throws JMSException
Sets client id on delegate

Specified by:
setClientID in interface Connection
Parameters:
clientID - new clientId
Throws:
JMSException

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
                          throws JMSException
sets exception listener on delegate

Specified by:
setExceptionListener in interface Connection
Parameters:
listener - new listener
Throws:
JMSException

start

public void start()
           throws JMSException
Specified by:
start in interface Connection
Throws:
JMSException

stop

public void stop()
          throws JMSException
Specified by:
stop in interface Connection
Throws:
JMSException

createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Queue queue,
                                                   String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
Specified by:
createConnectionConsumer in interface QueueConnection
Parameters:
queue -
messageSelector -
sessionPool -
maxMessages -
Returns:
Throws:
JMSException

createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Topic topic,
                                                   String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
Specified by:
createConnectionConsumer in interface TopicConnection
Parameters:
topic -
messageSelector -
sessionPool -
maxMessages -
Returns:
Throws:
JMSException

createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Destination destination,
                                                   String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
Specified by:
createConnectionConsumer in interface Connection
Parameters:
destination -
messageSelector -
sessionPool -
maxMessages -
Returns:
Throws:
JMSException

createDurableConnectionConsumer

public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
                                                          String subscriptionName,
                                                          String messageSelector,
                                                          ServerSessionPool sessionPool,
                                                          int maxMessages)
                                                   throws JMSException
Specified by:
createDurableConnectionConsumer in interface Connection
Specified by:
createDurableConnectionConsumer in interface TopicConnection
Parameters:
topic -
subscriptionName -
messageSelector -
sessionPool -
maxMessages -
Returns:
Throws:
JMSException

getManagedConnection

public ActiveMQManagedConnection getManagedConnection()
Returns:
Returns the managedConnection.

onException

public void onException(JMSException e)
Specified by:
onException in interface ExceptionListener


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.