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 Details

  • Constructor Details

  • 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:
      createSession in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • getClientID

      public String getClientID() throws jakarta.jms.JMSException
      Specified by:
      getClientID in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • setClientID

      public void setClientID(String clientID) throws jakarta.jms.JMSException
      Specified by:
      setClientID in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • getMetaData

      public jakarta.jms.ConnectionMetaData getMetaData() throws jakarta.jms.JMSException
      Specified by:
      getMetaData in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • getExceptionListener

      public jakarta.jms.ExceptionListener getExceptionListener() throws jakarta.jms.JMSException
      Specified by:
      getExceptionListener in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • setExceptionListener

      public void setExceptionListener(jakarta.jms.ExceptionListener listener) throws jakarta.jms.JMSException
      Specified by:
      setExceptionListener in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • start

      public void start() throws jakarta.jms.JMSException
      Specified by:
      start in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • signalStopToAllSessions

      public void signalStopToAllSessions()
    • stop

      public void stop() throws jakarta.jms.JMSException
      Specified by:
      stop in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • close

      public final void close() throws jakarta.jms.JMSException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface jakarta.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:
      createConnectionConsumer in interface jakarta.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:
      createDurableConnectionConsumer in interface jakarta.jms.Connection
      Specified by:
      createDurableConnectionConsumer in interface jakarta.jms.TopicConnection
      Throws:
      jakarta.jms.JMSException
    • createSession

      public jakarta.jms.Session createSession(int sessionMode) throws jakarta.jms.JMSException
      Specified by:
      createSession in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • createSession

      public jakarta.jms.Session createSession() throws jakarta.jms.JMSException
      Specified by:
      createSession in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • createQueueSession

      public jakarta.jms.QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException
      Specified by:
      createQueueSession in interface jakarta.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:
      createConnectionConsumer in interface jakarta.jms.QueueConnection
      Throws:
      jakarta.jms.JMSException
    • createTopicSession

      public jakarta.jms.TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException
      Specified by:
      createTopicSession in interface jakarta.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:
      createConnectionConsumer in interface jakarta.jms.TopicConnection
      Throws:
      jakarta.jms.JMSException
    • createSharedConnectionConsumer

      public jakarta.jms.ConnectionConsumer createSharedConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException
      Specified by:
      createSharedConnectionConsumer in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • createSharedDurableConnectionConsumer

      public jakarta.jms.ConnectionConsumer createSharedDurableConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException
      Specified by:
      createSharedDurableConnectionConsumer in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • setFailoverListener

      public void setFailoverListener(FailoverEventListener listener) throws jakarta.jms.JMSException
      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

      public FailoverEventListener getFailoverListener() throws jakarta.jms.JMSException
      Returns:
      FailoverEventListener the current failover event listener for this connection
      Throws:
      jakarta.jms.JMSException
    • addTemporaryQueue

      public void addTemporaryQueue(SimpleString queueAddress)
    • removeTemporaryQueue

      public void removeTemporaryQueue(SimpleString queueAddress)
    • containsTemporaryQueue

      public boolean containsTemporaryQueue(SimpleString queueAddress)
    • hasNoLocal

      public boolean hasNoLocal()
    • setHasNoLocal

      public void setHasNoLocal()
    • getUID

      public SimpleString getUID()
    • removeSession

      public void removeSession(ActiveMQSession session)
    • getInitialSession

      public ClientSession 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

      public ClientSessionFactory getSessionFactory()
    • createAMQSession

      protected ActiveMQSession createAMQSession(boolean isXA, boolean transacted, int acknowledgeMode, ClientSession session, int type)
      Parameters:
      transacted -
      acknowledgeMode -
      session -
      type -
      Returns:
    • 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

      public void setReference(ActiveMQConnectionFactory factory)
    • isStarted

      public boolean isStarted()
    • getDeserializationBlackList

      @Deprecated(forRemoval=true) public String getDeserializationBlackList()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDeserializationWhiteList

      @Deprecated(forRemoval=true) public String getDeserializationWhiteList()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDeserializationDenyList

      public String getDeserializationDenyList()
    • getDeserializationAllowList

      public String getDeserializationAllowList()