ActiveMQConnection (ActiveMQ Artemis Web 1.1.0.wildfly-010 API)
Date: 2015-12-18

org.apache.activemq.artemis.jms.client

## Class ActiveMQConnection

- java.lang.Object
- - org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl
  - - org.apache.activemq.artemis.jms.client.ActiveMQConnection

- All Implemented Interfaces:
    AutoCloseable, javax.jms.Connection, javax.jms.QueueConnection, javax.jms.TopicConnection, ActiveMQConnectionForContext
  Direct Known Subclasses:
    ActiveMQXAConnection

      public class ActiveMQConnection
      extends ActiveMQConnectionForContextImpl
      implements javax.jms.TopicConnection, javax.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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static SimpleString` | `CONNECTION_ID_PROPERTY_NAME`
    `static String` | `EXCEPTION_DISCONNECT`
    `static String` | `EXCEPTION_FAILOVER`
    `static int` | `TYPE_GENERIC_CONNECTION`
    `static int` | `TYPE_QUEUE_CONNECTION`
    `static int` | `TYPE_TOPIC_CONNECTION`

    - ### Fields inherited from class org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl

      `threadAwareContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ActiveMQConnection(String username, String password, int connectionType, String clientID, int dupsOKBatchSize, int transactionBatchSize, ClientSessionFactory sessionFactory)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKnownDestination(SimpleString address)`
    `void` | `addTemporaryQueue(SimpleString queueAddress)`
    `void` | `authorize()`
    `static int` | `checkAck(boolean transacted, int acknowledgeMode)` I'm keeping this as static as the same check will be done within RA.
    `protected void` | `checkClosed()`
    `void` | `close()`
    `boolean` | `containsKnownDestination(SimpleString address)`
    `boolean` | `containsTemporaryQueue(SimpleString queueAddress)`
    `protected ActiveMQSession` | `createAMQSession(boolean isXA, boolean transacted, int acknowledgeMode, ClientSession session, int type)`
    `javax.jms.ConnectionConsumer` | `createConnectionConsumer(javax.jms.Destination destination, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)`
    `javax.jms.ConnectionConsumer` | `createConnectionConsumer(javax.jms.Queue queue, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)`
    `javax.jms.ConnectionConsumer` | `createConnectionConsumer(javax.jms.Topic topic, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)`
    `javax.jms.ConnectionConsumer` | `createDurableConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)`
    `javax.jms.Session` | `createNonXAQueueSession(boolean transacted, int acknowledgeMode)` This internal method serves basically the Resource Adapter.
    `javax.jms.Session` | `createNonXASession(boolean transacted, int acknowledgeMode)` This internal method serves basically the Resource Adapter.
    `javax.jms.Session` | `createNonXATopicSession(boolean transacted, int acknowledgeMode)` This internal method serves basically the Resource Adapter.
    `javax.jms.QueueSession` | `createQueueSession(boolean transacted, int acknowledgeMode)`
    `javax.jms.Session` | `createSession()`
    `javax.jms.Session` | `createSession(boolean transacted, int acknowledgeMode)`
    `javax.jms.Session` | `createSession(int sessionMode)`
    `protected ActiveMQSession` | `createSessionInternal(boolean isXA, boolean transacted, int acknowledgeMode, int type)`
    `javax.jms.ConnectionConsumer` | `createSharedConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)`
    `javax.jms.ConnectionConsumer` | `createSharedDurableConnectionConsumer(javax.jms.Topic topic, String subscriptionName, String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)`
    `javax.jms.TopicSession` | `createTopicSession(boolean transacted, int acknowledgeMode)`
    `protected void` | `finalize()`
    `String` | `getClientID()`
    `javax.jms.ExceptionListener` | `getExceptionListener()`
    `FailoverEventListener` | `getFailoverListener()`
    `ClientSession` | `getInitialSession()`
    `javax.jms.ConnectionMetaData` | `getMetaData()`
    `SimpleString` | `getUID()`
    `boolean` | `hasNoLocal()`
    `boolean` | `isStarted()`
    `protected boolean` | `isXA()`
    `void` | `removeSession(ActiveMQSession session)`
    `void` | `removeTemporaryQueue(SimpleString queueAddress)`
    `void` | `setClientID(String clientID)`
    `void` | `setExceptionListener(javax.jms.ExceptionListener listener)`
    `void` | `setFailoverListener(FailoverEventListener listener)` Sets a FailureListener for the session which is notified if a failure occurs on the session.
    `void` | `setHasNoLocal()`
    `void` | `setReference(ActiveMQConnectionFactory factory)`
    `void` | `signalStopToAllSessions()`
    `void` | `start()`
    `void` | `stop()`

    - ### Methods inherited from class org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContextImpl

      `closeFromContext, createContext, createXAContext, getThreadAwareContext, incrementRefCounter`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TYPE_GENERIC_CONNECTION

          public static final int TYPE_GENERIC_CONNECTION

      See Also:
        Constant Field Values

    - #### TYPE_QUEUE_CONNECTION

          public static final int TYPE_QUEUE_CONNECTION

      See Also:
        Constant Field Values

    - #### TYPE_TOPIC_CONNECTION

          public static final int TYPE_TOPIC_CONNECTION

      See Also:
        Constant Field Values

    - #### EXCEPTION_FAILOVER

          public static final String EXCEPTION_FAILOVER

      See Also:
        Constant Field Values

    - #### EXCEPTION_DISCONNECT

          public static final String EXCEPTION_DISCONNECT

      See Also:
        Constant Field Values

    - #### CONNECTION_ID_PROPERTY_NAME

          public static final SimpleString CONNECTION_ID_PROPERTY_NAME

  - ### Constructor Detail

    - #### ActiveMQConnection

          public ActiveMQConnection(String username,
                                    String password,
                                    int connectionType,
                                    String clientID,
                                    int dupsOKBatchSize,
                                    int transactionBatchSize,
                                    ClientSessionFactory sessionFactory)

  - ### Method Detail

    - #### createNonXASession

          public javax.jms.Session createNonXASession(boolean transacted,
                                                      int acknowledgeMode)
                                               throws javax.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:
        `javax.jms.JMSException`

    - #### createNonXATopicSession

          public javax.jms.Session createNonXATopicSession(boolean transacted,
                                                           int acknowledgeMode)
                                                    throws javax.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:
        `javax.jms.JMSException`

    - #### createNonXAQueueSession

          public javax.jms.Session createNonXAQueueSession(boolean transacted,
                                                           int acknowledgeMode)
                                                    throws javax.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:
        `javax.jms.JMSException`

    - #### createSession

          public javax.jms.Session createSession(boolean transacted,
                                                 int acknowledgeMode)
                                          throws javax.jms.JMSException

      Specified by:
        `createSession` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### getClientID

          public String getClientID()
                             throws javax.jms.JMSException

      Specified by:
        `getClientID` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### setClientID

          public void setClientID(String clientID)
                           throws javax.jms.JMSException

      Specified by:
        `setClientID` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### getMetaData

          public javax.jms.ConnectionMetaData getMetaData()
                                                   throws javax.jms.JMSException

      Specified by:
        `getMetaData` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### getExceptionListener

          public javax.jms.ExceptionListener getExceptionListener()
                                                           throws javax.jms.JMSException

      Specified by:
        `getExceptionListener` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### setExceptionListener

          public void setExceptionListener(javax.jms.ExceptionListener listener)
                                    throws javax.jms.JMSException

      Specified by:
        `setExceptionListener` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### start

          public void start()
                     throws javax.jms.JMSException

      Specified by:
        `start` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### signalStopToAllSessions

          public void signalStopToAllSessions()

    - #### stop

          public void stop()
                    throws javax.jms.JMSException

      Specified by:
        `stop` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### close

          public final void close()
                           throws javax.jms.JMSException

      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### createConnectionConsumer

          public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination,
                                                                       String messageSelector,
                                                                       javax.jms.ServerSessionPool sessionPool,
                                                                       int maxMessages)
                                                                throws javax.jms.JMSException

      Specified by:
        `createConnectionConsumer` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### createDurableConnectionConsumer

          public javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
                                                                              String subscriptionName,
                                                                              String messageSelector,
                                                                              javax.jms.ServerSessionPool sessionPool,
                                                                              int maxMessages)
                                                                       throws javax.jms.JMSException

      Specified by:
        `createDurableConnectionConsumer` in interface `javax.jms.Connection`
      Specified by:
        `createDurableConnectionConsumer` in interface `javax.jms.TopicConnection`
      Throws:
        `javax.jms.JMSException`

    - #### createSession

          public javax.jms.Session createSession(int sessionMode)
                                          throws javax.jms.JMSException

      Specified by:
        `createSession` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### createSession

          public javax.jms.Session createSession()
                                          throws javax.jms.JMSException

      Specified by:
        `createSession` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### createQueueSession

          public javax.jms.QueueSession createQueueSession(boolean transacted,
                                                           int acknowledgeMode)
                                                    throws javax.jms.JMSException

      Specified by:
        `createQueueSession` in interface `javax.jms.QueueConnection`
      Throws:
        `javax.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 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Queue queue,
                                                                       String messageSelector,
                                                                       javax.jms.ServerSessionPool sessionPool,
                                                                       int maxMessages)
                                                                throws javax.jms.JMSException

      Specified by:
        `createConnectionConsumer` in interface `javax.jms.QueueConnection`
      Throws:
        `javax.jms.JMSException`

    - #### createTopicSession

          public javax.jms.TopicSession createTopicSession(boolean transacted,
                                                           int acknowledgeMode)
                                                    throws javax.jms.JMSException

      Specified by:
        `createTopicSession` in interface `javax.jms.TopicConnection`
      Throws:
        `javax.jms.JMSException`

    - #### createConnectionConsumer

          public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic,
                                                                       String messageSelector,
                                                                       javax.jms.ServerSessionPool sessionPool,
                                                                       int maxMessages)
                                                                throws javax.jms.JMSException

      Specified by:
        `createConnectionConsumer` in interface `javax.jms.TopicConnection`
      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:
        `createSharedConnectionConsumer` in interface `javax.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:
        `createSharedDurableConnectionConsumer` in interface `javax.jms.Connection`
      Throws:
        `javax.jms.JMSException`

    - #### setFailoverListener

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

    - #### getFailoverListener

          public FailoverEventListener getFailoverListener()
                                                    throws javax.jms.JMSException

      Returns:
        `FailoverEventListener` the current failover event listener for this connection
      Throws:
        `javax.jms.JMSException`

    - #### addTemporaryQueue

          public void addTemporaryQueue(SimpleString queueAddress)

    - #### removeTemporaryQueue

          public void removeTemporaryQueue(SimpleString queueAddress)

    - #### addKnownDestination

          public void addKnownDestination(SimpleString address)

    - #### containsKnownDestination

          public boolean containsKnownDestination(SimpleString address)

    - #### 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()

    - #### finalize

          protected final void finalize()
                                 throws Throwable

      Overrides:
        `finalize` in class `Object`
      Throws:
        `Throwable`

    - #### isXA

          protected boolean isXA()

    - #### createSessionInternal

          protected final ActiveMQSession createSessionInternal(boolean isXA,
                                                                boolean transacted,
                                                                int acknowledgeMode,
                                                                int type)
                                                         throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### 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 javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### authorize

          public void authorize()
                         throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### setReference

          public void setReference(ActiveMQConnectionFactory factory)

    - #### isStarted

          public boolean isStarted()

Copyright © 2015. All rights reserved.