Package org.apache.activemq.ra
Class ManagedConnectionProxy
- java.lang.Object
-
- 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
Constructors Constructor Description ManagedConnectionProxy(ActiveMQManagedConnection managedConnection, ConnectionRequestInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 delegatevoid
setExceptionListener(ExceptionListener listener)
sets exception listener on delegatevoid
setUseSharedTxContext(boolean enable)
void
start()
void
stop()
-
-
-
Constructor Detail
-
ManagedConnectionProxy
public ManagedConnectionProxy(ActiveMQManagedConnection managedConnection, ConnectionRequestInfo info)
-
-
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 interfaceConnection
- 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 interfaceConnection
- Parameters:
transacted
- Whether session is transactedacknowledgeMode
- 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 interfaceQueueConnection
- Parameters:
transacted
- Whether session is transactedacknowledgeMode
- session acknowledge mode- Returns:
- session proxy
- Throws:
JMSException
- on error
-
createTopicSession
public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
- Specified by:
createTopicSession
in interfaceTopicConnection
- Parameters:
transacted
- Whether session is transactedacknowledgeMode
- session acknowledge mode- Returns:
- session proxy
- Throws:
JMSException
- on error
-
getClientID
public String getClientID() throws JMSException
- Specified by:
getClientID
in interfaceConnection
- Returns:
- client id from delegate
- Throws:
JMSException
-
getExceptionListener
public ExceptionListener getExceptionListener() throws JMSException
- Specified by:
getExceptionListener
in interfaceConnection
- Returns:
- exception listener from delegate
- Throws:
JMSException
-
getMetaData
public ConnectionMetaData getMetaData() throws JMSException
- Specified by:
getMetaData
in interfaceConnection
- Returns:
- connection metadata from delegate
- Throws:
JMSException
-
setClientID
public void setClientID(String clientID) throws JMSException
Sets client id on delegate- Specified by:
setClientID
in interfaceConnection
- Parameters:
clientID
- new clientId- Throws:
JMSException
-
setExceptionListener
public void setExceptionListener(ExceptionListener listener) throws JMSException
sets exception listener on delegate- Specified by:
setExceptionListener
in interfaceConnection
- Parameters:
listener
- new listener- Throws:
JMSException
-
start
public void start() throws JMSException
- Specified by:
start
in interfaceConnection
- Throws:
JMSException
-
stop
public void stop() throws JMSException
- Specified by:
stop
in interfaceConnection
- Throws:
JMSException
-
createConnectionConsumer
public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
- Specified by:
createConnectionConsumer
in interfaceQueueConnection
- 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 interfaceTopicConnection
- 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 interfaceConnection
- 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 interfaceConnection
- Specified by:
createDurableConnectionConsumer
in interfaceTopicConnection
- 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 interfaceExceptionListener
-
-