Package org.apache.activemq.artemis.ra
Class ActiveMQRASessionFactoryImpl
- java.lang.Object
-
- org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
-
- org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl
-
- All Implemented Interfaces:
AutoCloseable,javax.jms.Connection,javax.jms.QueueConnection,javax.jms.TopicConnection,javax.jms.XAConnection,javax.jms.XAQueueConnection,javax.jms.XATopicConnection,Referenceable,javax.resource.Referenceable,ActiveMQConnectionForContext,ActiveMQRASessionFactory
public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForContextImpl implements ActiveMQRASessionFactory, ActiveMQConnectionForContext, javax.resource.Referenceable
Implements the JMS Connection API and producesActiveMQRASessionobjects.
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
threadAwareContext
-
Fields inherited from interface org.apache.activemq.artemis.ra.ActiveMQRASessionFactory
ISE
-
-
Constructor Summary
Constructors Constructor Description ActiveMQRASessionFactoryImpl(ActiveMQRAManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm, javax.transaction.TransactionSynchronizationRegistry tsr, int type)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTemporaryQueue(javax.jms.TemporaryQueue temp)Add temporary queuevoidaddTemporaryTopic(javax.jms.TemporaryTopic temp)Add temporary topicprotected ActiveMQRASessionallocateConnection(boolean transacted, int acknowledgeMode, int sessionType)Allocate a connectionprotected ActiveMQRASessionallocateConnection(int sessionType)Allocation a connectionprotected voidcheckClosed()Check if we are closedvoidclose()ClosevoidcloseSession(ActiveMQRASession session)Close sessionjavax.jms.ConnectionConsumercreateConnectionConsumer(javax.jms.Destination destination, String name, javax.jms.ServerSessionPool pool, int maxMessages)Create a connection consumer -- throws IllegalStateExceptionjavax.jms.ConnectionConsumercreateConnectionConsumer(javax.jms.Destination destination, javax.jms.ServerSessionPool pool, int maxMessages)Create a connection consumer -- throws IllegalStateExceptionjavax.jms.ConnectionConsumercreateConnectionConsumer(javax.jms.Queue queue, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)Create a connection consumer -- throws IllegalStateExceptionjavax.jms.ConnectionConsumercreateConnectionConsumer(javax.jms.Topic topic, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)Create a connection consumer -- throws IllegalStateExceptionjavax.jms.JMSContextcreateContext(int sessionMode)javax.jms.ConnectionConsumercreateDurableConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)Create a durable connection consumer -- throws IllegalStateExceptionjavax.jms.QueueSessioncreateQueueSession(boolean transacted, int acknowledgeMode)Create a queue sessionjavax.jms.SessioncreateSession()javax.jms.SessioncreateSession(boolean transacted, int acknowledgeMode)Create a sessionjavax.jms.SessioncreateSession(int sessionMode)javax.jms.ConnectionConsumercreateSharedConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)javax.jms.ConnectionConsumercreateSharedDurableConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)javax.jms.TopicSessioncreateTopicSession(boolean transacted, int acknowledgeMode)Create a topic sessionjavax.jms.XAJMSContextcreateXAContext()javax.jms.XAQueueSessioncreateXAQueueSession()Create a XA queue sessionjavax.jms.XASessioncreateXASession()Create a XA sessionjavax.jms.XATopicSessioncreateXATopicSession()Create a XA topic sessionStringgetClientID()Get the client IDjavax.jms.ExceptionListenergetExceptionListener()Get the exception listener -- throws IllegalStateExceptionjavax.jms.ConnectionMetaDatagetMetaData()Get the connection metadataReferencegetReference()Get the naming referencevoidsetClientID(String cID)Set the client ID -- throws IllegalStateExceptionvoidsetExceptionListener(javax.jms.ExceptionListener listener)Set the exception listener -- throws IllegalStateExceptionvoidsetPassword(String password)Set the passwordvoidsetReference(Reference reference)Set the naming referencevoidsetUserName(String name)Set the user namevoidstart()Startvoidstop()Stop-
Methods inherited from class org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
closeFromContext, getThreadAwareContext, incrementRefCounter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContext
closeFromContext
-
-
-
-
Constructor Detail
-
ActiveMQRASessionFactoryImpl
public ActiveMQRASessionFactoryImpl(ActiveMQRAManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm, javax.transaction.TransactionSynchronizationRegistry tsr, int type)
Constructor- Parameters:
mcf- The managed connection factorycm- The connection managertype- The connection type
-
-
Method Detail
-
createContext
public javax.jms.JMSContext createContext(int sessionMode)
- Specified by:
createContextin interfaceActiveMQConnectionForContext- Overrides:
createContextin classActiveMQConnectionForContextImpl
-
createXAContext
public javax.jms.XAJMSContext createXAContext()
- Specified by:
createXAContextin interfaceActiveMQConnectionForContext- Overrides:
createXAContextin classActiveMQConnectionForContextImpl
-
setReference
public void setReference(Reference reference)
Set the naming reference- Specified by:
setReferencein interfacejavax.resource.Referenceable- Parameters:
reference- The reference
-
getReference
public Reference getReference()
Get the naming reference- Specified by:
getReferencein interfaceReferenceable- Returns:
- The reference
-
setUserName
public void setUserName(String name)
Set the user name- Parameters:
name- The user name
-
setPassword
public void setPassword(String password)
Set the password- Parameters:
password- The password
-
getClientID
public String getClientID() throws javax.jms.JMSException
Get the client ID- Specified by:
getClientIDin interfacejavax.jms.Connection- Returns:
- The client ID
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
setClientID
public void setClientID(String cID) throws javax.jms.JMSException
Set the client ID -- throws IllegalStateException- Specified by:
setClientIDin interfacejavax.jms.Connection- Parameters:
cID- The client ID- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createQueueSession
public javax.jms.QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSExceptionCreate a queue session- Specified by:
createQueueSessionin interfacejavax.jms.QueueConnection- Specified by:
createQueueSessionin interfacejavax.jms.XAQueueConnection- Parameters:
transacted- Use transactionsacknowledgeMode- The acknowledge mode- Returns:
- The queue session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createXAQueueSession
public javax.jms.XAQueueSession createXAQueueSession() throws javax.jms.JMSExceptionCreate a XA queue session- Specified by:
createXAQueueSessionin interfacejavax.jms.XAQueueConnection- Returns:
- The XA queue session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Queue queue, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSExceptionCreate a connection consumer -- throws IllegalStateException- Specified by:
createConnectionConsumerin interfacejavax.jms.QueueConnection- Parameters:
queue- The queuemessageSelector- The message selectorsessionPool- The session poolmaxMessages- The number of max messages- Returns:
- The connection consumer
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createTopicSession
public javax.jms.TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSExceptionCreate a topic session- Specified by:
createTopicSessionin interfacejavax.jms.TopicConnection- Specified by:
createTopicSessionin interfacejavax.jms.XATopicConnection- Parameters:
transacted- Use transactionsacknowledgeMode- The acknowledge mode- Returns:
- The topic session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createXATopicSession
public javax.jms.XATopicSession createXATopicSession() throws javax.jms.JMSExceptionCreate a XA topic session- Specified by:
createXATopicSessionin interfacejavax.jms.XATopicConnection- Returns:
- The XA topic session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSExceptionCreate a connection consumer -- throws IllegalStateException- Specified by:
createConnectionConsumerin interfacejavax.jms.TopicConnection- Parameters:
topic- The topicmessageSelector- The message selectorsessionPool- The session poolmaxMessages- The number of max messages- Returns:
- The connection consumer
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createDurableConnectionConsumer
public javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSExceptionCreate a durable connection consumer -- throws IllegalStateException- Specified by:
createDurableConnectionConsumerin interfacejavax.jms.Connection- Specified by:
createDurableConnectionConsumerin interfacejavax.jms.TopicConnection- Parameters:
topic- The topicsubscriptionName- The subscription namemessageSelector- The message selectorsessionPool- The session poolmaxMessages- The number of max messages- Returns:
- The connection consumer
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination, javax.jms.ServerSessionPool pool, int maxMessages) throws javax.jms.JMSExceptionCreate a connection consumer -- throws IllegalStateException- Parameters:
destination- The destinationpool- The session poolmaxMessages- The number of max messages- Returns:
- The connection consumer
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination, String name, javax.jms.ServerSessionPool pool, int maxMessages) throws javax.jms.JMSExceptionCreate a connection consumer -- throws IllegalStateException- Specified by:
createConnectionConsumerin interfacejavax.jms.Connection- Parameters:
destination- The destinationname- The namepool- The session poolmaxMessages- The number of max messages- Returns:
- The connection consumer
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createSession
public javax.jms.Session createSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSExceptionCreate a session- Specified by:
createSessionin interfacejavax.jms.Connection- Specified by:
createSessionin interfacejavax.jms.XAConnection- Parameters:
transacted- Use transactionsacknowledgeMode- The acknowledge mode- Returns:
- The session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
createXASession
public javax.jms.XASession createXASession() throws javax.jms.JMSExceptionCreate a XA session- Specified by:
createXASessionin interfacejavax.jms.XAConnection- Returns:
- The XA session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
getMetaData
public javax.jms.ConnectionMetaData getMetaData() throws javax.jms.JMSExceptionGet the connection metadata- Specified by:
getMetaDatain interfacejavax.jms.Connection- Returns:
- The connection metadata
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
getExceptionListener
public javax.jms.ExceptionListener getExceptionListener() throws javax.jms.JMSExceptionGet the exception listener -- throws IllegalStateException- Specified by:
getExceptionListenerin interfacejavax.jms.Connection- Returns:
- The exception listener
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
setExceptionListener
public void setExceptionListener(javax.jms.ExceptionListener listener) throws javax.jms.JMSExceptionSet the exception listener -- throws IllegalStateException- Specified by:
setExceptionListenerin interfacejavax.jms.Connection- Parameters:
listener- The exception listener- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
start
public void start() throws javax.jms.JMSExceptionStart- Specified by:
startin interfacejavax.jms.Connection- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
stop
public void stop() throws javax.jms.JMSExceptionStop- Specified by:
stopin interfacejavax.jms.Connection- Throws:
javax.jms.IllegalStateExceptionjavax.jms.JMSException- Thrown if an error occurs
-
close
public void close() throws javax.jms.JMSExceptionClose- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejavax.jms.Connection- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
closeSession
public void closeSession(ActiveMQRASession session) throws javax.jms.JMSException
Close session- Specified by:
closeSessionin interfaceActiveMQRASessionFactory- Parameters:
session- The session- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
addTemporaryQueue
public void addTemporaryQueue(javax.jms.TemporaryQueue temp)
Add temporary queue- Specified by:
addTemporaryQueuein interfaceActiveMQRASessionFactory- Parameters:
temp- The temporary queue
-
addTemporaryTopic
public void addTemporaryTopic(javax.jms.TemporaryTopic temp)
Add temporary topic- Specified by:
addTemporaryTopicin interfaceActiveMQRASessionFactory- Parameters:
temp- The temporary topic
-
createSession
public javax.jms.Session createSession(int sessionMode) throws javax.jms.JMSException- Specified by:
createSessionin interfacejavax.jms.Connection- Throws:
javax.jms.JMSException
-
createSession
public javax.jms.Session createSession() throws javax.jms.JMSException- Specified by:
createSessionin interfacejavax.jms.Connection- Throws:
javax.jms.JMSException
-
createSharedConnectionConsumer
public javax.jms.ConnectionConsumer createSharedConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSException- Specified by:
createSharedConnectionConsumerin interfacejavax.jms.Connection- Throws:
javax.jms.JMSException
-
createSharedDurableConnectionConsumer
public javax.jms.ConnectionConsumer createSharedDurableConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSException- Specified by:
createSharedDurableConnectionConsumerin interfacejavax.jms.Connection- Throws:
javax.jms.JMSException
-
allocateConnection
protected ActiveMQRASession allocateConnection(int sessionType) throws javax.jms.JMSException
Allocation a connection- Parameters:
sessionType- The session type- Returns:
- The session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
allocateConnection
protected ActiveMQRASession allocateConnection(boolean transacted, int acknowledgeMode, int sessionType) throws javax.jms.JMSException
Allocate a connection- Parameters:
transacted- Use transactionsacknowledgeMode- The acknowledge modesessionType- The session type- Returns:
- The session
- Throws:
javax.jms.JMSException- Thrown if an error occurs
-
checkClosed
protected void checkClosed() throws javax.jms.IllegalStateExceptionCheck if we are closed- Throws:
javax.jms.IllegalStateException- Thrown if closed
-
-