Class ActiveMQConnection
java.lang.Object
org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
org.apache.activemq.artemis.jms.client.ActiveMQConnection
- All Implemented Interfaces:
jakarta.jms.Connection,jakarta.jms.QueueConnection,jakarta.jms.TopicConnection,AutoCloseable,ActiveMQConnectionForContext
- Direct Known Subclasses:
ActiveMQXAConnection
public class ActiveMQConnection
extends ActiveMQConnectionForContextImpl
implements jakarta.jms.TopicConnection, jakarta.jms.QueueConnection
ActiveMQ Artemis implementation of a JMS Connection.
The flat implementation of TopicConnection and QueueConnection is per design, following the common
usage of these as one flat API in JMS 1.1.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SimpleStringstatic final Stringstatic final Stringstatic final intstatic final intstatic final intFields inherited from class org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
threadAwareContext -
Constructor Summary
ConstructorsConstructorDescriptionActiveMQConnection(ConnectionFactoryOptions options, String username, String password, int connectionType, String clientID, int dupsOKBatchSize, int transactionBatchSize, boolean cacheDestinations, boolean enable1xPrefixes, ClientSessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTemporaryQueue(SimpleString queueAddress) voidvoidauthorize(boolean validateClientId) static intcheckAck(boolean transacted, int acknowledgeMode) I'm keeping this as static as the same check will be done within RA.protected final voidfinal voidclose()booleancontainsTemporaryQueue(SimpleString queueAddress) protected ActiveMQSessioncreateAMQSession(boolean isXA, boolean transacted, int acknowledgeMode, ClientSession session, int type) jakarta.jms.ConnectionConsumercreateConnectionConsumer(jakarta.jms.Destination destination, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) jakarta.jms.ConnectionConsumercreateConnectionConsumer(jakarta.jms.Queue queue, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) jakarta.jms.ConnectionConsumercreateConnectionConsumer(jakarta.jms.Topic topic, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) jakarta.jms.ConnectionConsumercreateDurableConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) jakarta.jms.SessioncreateNonXAQueueSession(boolean transacted, int acknowledgeMode) This internal method serves basically the Resource Adapter.jakarta.jms.SessioncreateNonXASession(boolean transacted, int acknowledgeMode) This internal method serves basically the Resource Adapter.jakarta.jms.SessioncreateNonXATopicSession(boolean transacted, int acknowledgeMode) This internal method serves basically the Resource Adapter.jakarta.jms.QueueSessioncreateQueueSession(boolean transacted, int acknowledgeMode) jakarta.jms.Sessionjakarta.jms.SessioncreateSession(boolean transacted, int acknowledgeMode) jakarta.jms.SessioncreateSession(int sessionMode) protected final ActiveMQSessioncreateSessionInternal(boolean isXA, boolean transacted, int acknowledgeMode, int type) jakarta.jms.ConnectionConsumercreateSharedConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) jakarta.jms.ConnectionConsumercreateSharedDurableConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) jakarta.jms.TopicSessioncreateTopicSession(boolean transacted, int acknowledgeMode) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.jakarta.jms.ExceptionListenerReturnsFailoverEventListenerthe current failover event listener for this connection.jakarta.jms.ConnectionMetaDatagetUID()booleanbooleanprotected booleanisXA()voidremoveSession(ActiveMQSession session) voidremoveTemporaryQueue(SimpleString queueAddress) voidsetClientID(String clientID) voidsetExceptionListener(jakarta.jms.ExceptionListener listener) voidsetFailoverListener(FailoverEventListener listener) Sets a FailureListener for the session which is notified if a failure occurs on the session.voidvoidsetReference(ActiveMQConnectionFactory factory) voidvoidstart()voidstop()Methods inherited from class org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
closeFromContext, createContext, createXAContext, getThreadAwareContext, incrementRefCounter
-
Field Details
-
TYPE_GENERIC_CONNECTION
public static final int TYPE_GENERIC_CONNECTION- See Also:
-
TYPE_QUEUE_CONNECTION
public static final int TYPE_QUEUE_CONNECTION- See Also:
-
TYPE_TOPIC_CONNECTION
public static final int TYPE_TOPIC_CONNECTION- See Also:
-
EXCEPTION_FAILOVER
- See Also:
-
EXCEPTION_DISCONNECT
- See Also:
-
CONNECTION_ID_PROPERTY_NAME
-
-
Constructor Details
-
ActiveMQConnection
public ActiveMQConnection(ConnectionFactoryOptions options, String username, String password, int connectionType, String clientID, int dupsOKBatchSize, int transactionBatchSize, boolean cacheDestinations, boolean enable1xPrefixes, ClientSessionFactory sessionFactory)
-
-
Method Details
-
createNonXASession
public jakarta.jms.Session createNonXASession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException This internal method serves basically the Resource Adapter. The resource adapter plays with an XASession and a non XASession. When there is no enlisted transaction, the EE specification mandates that the commit should be done as if it was a nonXA Session (i.e. SessionTransacted). For that reason we have this method to force that nonXASession, since the JMS Javadoc mandates createSession to return a XASession.- Throws:
jakarta.jms.JMSException
-
createNonXATopicSession
public jakarta.jms.Session createNonXATopicSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException This internal method serves basically the Resource Adapter. The resource adapter plays with an XASession and a non XASession. When there is no enlisted transaction, the EE specification mandates that the commit should be done as if it was a nonXA Session (i.e. SessionTransacted). For that reason we have this method to force that nonXASession, since the JMS Javadoc mandates createSession to return a XASession.- Throws:
jakarta.jms.JMSException
-
createNonXAQueueSession
public jakarta.jms.Session createNonXAQueueSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException This internal method serves basically the Resource Adapter. The resource adapter plays with an XASession and a non XASession. When there is no enlisted transaction, the EE specification mandates that the commit should be done as if it was a nonXA Session (i.e. SessionTransacted). For that reason we have this method to force that nonXASession, since the JMS Javadoc mandates createSession to return a XASession.- Throws:
jakarta.jms.JMSException
-
createSession
public jakarta.jms.Session createSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException - Specified by:
createSessionin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
getClientID
- Specified by:
getClientIDin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
setClientID
- Specified by:
setClientIDin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
getMetaData
public jakarta.jms.ConnectionMetaData getMetaData() throws jakarta.jms.JMSException- Specified by:
getMetaDatain interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
getExceptionListener
public jakarta.jms.ExceptionListener getExceptionListener() throws jakarta.jms.JMSException- Specified by:
getExceptionListenerin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
setExceptionListener
public void setExceptionListener(jakarta.jms.ExceptionListener listener) throws jakarta.jms.JMSException - Specified by:
setExceptionListenerin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
start
public void start() throws jakarta.jms.JMSException- Specified by:
startin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
signalStopToAllSessions
public void signalStopToAllSessions() -
stop
public void stop() throws jakarta.jms.JMSException- Specified by:
stopin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
close
public final void close() throws jakarta.jms.JMSException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
createConnectionConsumer
public jakarta.jms.ConnectionConsumer createConnectionConsumer(jakarta.jms.Destination destination, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException - Specified by:
createConnectionConsumerin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
createDurableConnectionConsumer
public jakarta.jms.ConnectionConsumer createDurableConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException - Specified by:
createDurableConnectionConsumerin interfacejakarta.jms.Connection- Specified by:
createDurableConnectionConsumerin interfacejakarta.jms.TopicConnection- Throws:
jakarta.jms.JMSException
-
createSession
public jakarta.jms.Session createSession(int sessionMode) throws jakarta.jms.JMSException - Specified by:
createSessionin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
createSession
public jakarta.jms.Session createSession() throws jakarta.jms.JMSException- Specified by:
createSessionin interfacejakarta.jms.Connection- Throws:
jakarta.jms.JMSException
-
createQueueSession
public jakarta.jms.QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException - Specified by:
createQueueSessionin interfacejakarta.jms.QueueConnection- Throws:
jakarta.jms.JMSException
-
checkAck
public static int checkAck(boolean transacted, int acknowledgeMode) I'm keeping this as static as the same check will be done within RA. This is to conform with TCK Tests where we must return ackMode exactly as they want if transacted=false -
createConnectionConsumer
public jakarta.jms.ConnectionConsumer createConnectionConsumer(jakarta.jms.Queue queue, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException - Specified by:
createConnectionConsumerin interfacejakarta.jms.QueueConnection- Throws:
jakarta.jms.JMSException
-
createTopicSession
public jakarta.jms.TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException - Specified by:
createTopicSessionin interfacejakarta.jms.TopicConnection- Throws:
jakarta.jms.JMSException
-
createConnectionConsumer
public jakarta.jms.ConnectionConsumer createConnectionConsumer(jakarta.jms.Topic topic, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException - Specified by:
createConnectionConsumerin interfacejakarta.jms.TopicConnection- Throws:
jakarta.jms.JMSException
-
setFailoverListener
Sets a FailureListener for the session which is notified if a failure occurs on the session.- Parameters:
listener- the listener to add- Throws:
jakarta.jms.JMSException
-
getFailoverListener
ReturnsFailoverEventListenerthe current failover event listener for this connection.- Returns:
FailoverEventListenerthe current failover event listener for this connection- Throws:
jakarta.jms.JMSException
-
addTemporaryQueue
-
removeTemporaryQueue
-
containsTemporaryQueue
-
hasNoLocal
public boolean hasNoLocal() -
setHasNoLocal
public void setHasNoLocal() -
getUID
-
removeSession
-
getInitialSession
-
isXA
protected boolean isXA() -
createSessionInternal
protected final ActiveMQSession createSessionInternal(boolean isXA, boolean transacted, int acknowledgeMode, int type) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
getSessionFactory
-
createAMQSession
protected ActiveMQSession createAMQSession(boolean isXA, boolean transacted, int acknowledgeMode, ClientSession session, int type) -
checkClosed
protected final void checkClosed() throws jakarta.jms.JMSException- Throws:
jakarta.jms.JMSException
-
authorize
public void authorize() throws jakarta.jms.JMSException- Throws:
jakarta.jms.JMSException
-
authorize
public void authorize(boolean validateClientId) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
setReference
-
isStarted
public boolean isStarted() -
getDeserializationBlackList
Deprecated, for removal: This API element is subject to removal in a future version. -
getDeserializationWhiteList
Deprecated, for removal: This API element is subject to removal in a future version. -
getDeserializationDenyList
-
getDeserializationAllowList
-