org.apache.activemq.artemis.jms.client

## Class ActiveMQSession

- java.lang.Object
- - org.apache.activemq.artemis.jms.client.ActiveMQSession

- All Implemented Interfaces:
    AutoCloseable, Runnable, javax.jms.QueueSession, javax.jms.Session, javax.jms.TopicSession
  Direct Known Subclasses:
    ActiveMQXASession

      public class ActiveMQSession
      extends Object
      implements javax.jms.QueueSession, javax.jms.TopicSession

  ActiveMQ Artemis implementation of a JMS Session.
  Note that we *do not* support JMS ASF (Application Server Facilities) optional constructs such as ConnectionConsumer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `TYPE_GENERIC_SESSION`
    `static int` | `TYPE_QUEUE_SESSION`
    `static int` | `TYPE_TOPIC_SESSION`

    - ### Fields inherited from interface javax.jms.Session

      `AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ActiveMQSession(ActiveMQConnection connection, boolean transacted, boolean xa, int ackMode, ClientSession session, int sessionType)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `ackAllConsumers()`
    `void` | `close()`
    `void` | `commit()`
    `javax.jms.QueueBrowser` | `createBrowser(javax.jms.Queue queue)`
    `javax.jms.QueueBrowser` | `createBrowser(javax.jms.Queue queue, String filterString)`
    `javax.jms.BytesMessage` | `createBytesMessage()`
    `javax.jms.MessageConsumer` | `createConsumer(javax.jms.Destination destination)`
    `javax.jms.MessageConsumer` | `createConsumer(javax.jms.Destination destination, String messageSelector)`
    `javax.jms.MessageConsumer` | `createConsumer(javax.jms.Destination destination, String messageSelector, boolean noLocal)`
    `javax.jms.MessageConsumer` | `createDurableConsumer(javax.jms.Topic topic, String name)`
    `javax.jms.MessageConsumer` | `createDurableConsumer(javax.jms.Topic topic, String name, String messageSelector, boolean noLocal)`
    `javax.jms.TopicSubscriber` | `createDurableSubscriber(javax.jms.Topic topic, String name)`
    `javax.jms.TopicSubscriber` | `createDurableSubscriber(javax.jms.Topic topic, String name, String messageSelector, boolean noLocal)`
    `javax.jms.MapMessage` | `createMapMessage()`
    `javax.jms.Message` | `createMessage()`
    `javax.jms.ObjectMessage` | `createObjectMessage()`
    `javax.jms.ObjectMessage` | `createObjectMessage(Serializable object)`
    `javax.jms.MessageProducer` | `createProducer(javax.jms.Destination destination)`
    `javax.jms.TopicPublisher` | `createPublisher(javax.jms.Topic topic)`
    `javax.jms.Queue` | `createQueue(String queueName)`
    `javax.jms.QueueReceiver` | `createReceiver(javax.jms.Queue queue)`
    `javax.jms.QueueReceiver` | `createReceiver(javax.jms.Queue queue, String messageSelector)`
    `javax.jms.QueueSender` | `createSender(javax.jms.Queue queue)`
    `javax.jms.MessageConsumer` | `createSharedConsumer(javax.jms.Topic topic, String sharedSubscriptionName)`
    `javax.jms.MessageConsumer` | `createSharedConsumer(javax.jms.Topic topic, String name, String messageSelector)` Note: Needs to throw an exception if a subscriptionName is already in use by another topic, or if the messageSelector is different validate multiple subscriptions on the same session.
    `javax.jms.MessageConsumer` | `createSharedDurableConsumer(javax.jms.Topic topic, String name)`
    `javax.jms.MessageConsumer` | `createSharedDurableConsumer(javax.jms.Topic topic, String name, String messageSelector)`
    `javax.jms.StreamMessage` | `createStreamMessage()`
    `javax.jms.TopicSubscriber` | `createSubscriber(javax.jms.Topic topic)`
    `javax.jms.TopicSubscriber` | `createSubscriber(javax.jms.Topic topic, String messageSelector, boolean noLocal)`
    `javax.jms.TemporaryQueue` | `createTemporaryQueue()`
    `javax.jms.TemporaryTopic` | `createTemporaryTopic()`
    `javax.jms.TextMessage` | `createTextMessage()`
    `javax.jms.TextMessage` | `createTextMessage(String text)`
    `javax.jms.Topic` | `createTopic(String topicName)`
    `void` | `deleteTemporaryQueue(ActiveMQDestination tempQueue)`
    `void` | `deleteTemporaryTopic(ActiveMQDestination tempTopic)`
    `int` | `getAcknowledgeMode()`
    `ClientSession` | `getCoreSession()`
    `javax.jms.MessageListener` | `getMessageListener()`
    `javax.jms.QueueSession` | `getQueueSession()`
    `javax.jms.Session` | `getSession()`
    `javax.jms.TopicSession` | `getTopicSession()`
    `boolean` | `getTransacted()`
    `XAResource` | `getXAResource()`
    `boolean` | `isRecoverCalled()`
    `boolean` | `isXA()`
    `void` | `recover()`
    `void` | `removeConsumer(ActiveMQMessageConsumer consumer)`
    `void` | `rollback()`
    `void` | `run()`
    `void` | `setMessageListener(javax.jms.MessageListener listener)`
    `void` | `setRecoverCalled(boolean recoverCalled)`
    `void` | `start()`
    `void` | `stop()`
    `String` | `toString()`
    `void` | `unsubscribe(String name)`

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

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

- - ### Field Detail

    - #### TYPE_GENERIC_SESSION

          public static final int TYPE_GENERIC_SESSION

      See Also:
        Constant Field Values

    - #### TYPE_QUEUE_SESSION

          public static final int TYPE_QUEUE_SESSION

      See Also:
        Constant Field Values

    - #### TYPE_TOPIC_SESSION

          public static final int TYPE_TOPIC_SESSION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ActiveMQSession

          protected ActiveMQSession(ActiveMQConnection connection,
                                    boolean transacted,
                                    boolean xa,
                                    int ackMode,
                                    ClientSession session,
                                    int sessionType)

  - ### Method Detail

    - #### createBytesMessage

          public javax.jms.BytesMessage createBytesMessage()
                                                    throws javax.jms.JMSException

      Specified by:
        `createBytesMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createMapMessage

          public javax.jms.MapMessage createMapMessage()
                                                throws javax.jms.JMSException

      Specified by:
        `createMapMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createMessage

          public javax.jms.Message createMessage()
                                          throws javax.jms.JMSException

      Specified by:
        `createMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createObjectMessage

          public javax.jms.ObjectMessage createObjectMessage()
                                                      throws javax.jms.JMSException

      Specified by:
        `createObjectMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createObjectMessage

          public javax.jms.ObjectMessage createObjectMessage(Serializable object)
                                                      throws javax.jms.JMSException

      Specified by:
        `createObjectMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createStreamMessage

          public javax.jms.StreamMessage createStreamMessage()
                                                      throws javax.jms.JMSException

      Specified by:
        `createStreamMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createTextMessage

          public javax.jms.TextMessage createTextMessage()
                                                  throws javax.jms.JMSException

      Specified by:
        `createTextMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createTextMessage

          public javax.jms.TextMessage createTextMessage(String text)
                                                  throws javax.jms.JMSException

      Specified by:
        `createTextMessage` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### getTransacted

          public boolean getTransacted()
                                throws javax.jms.JMSException

      Specified by:
        `getTransacted` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### getAcknowledgeMode

          public int getAcknowledgeMode()
                                 throws javax.jms.JMSException

      Specified by:
        `getAcknowledgeMode` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### isXA

          public boolean isXA()

    - #### commit

          public void commit()
                      throws javax.jms.JMSException

      Specified by:
        `commit` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### rollback

          public void rollback()
                        throws javax.jms.JMSException

      Specified by:
        `rollback` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### close

          public void close()
                     throws javax.jms.JMSException

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

    - #### recover

          public void recover()
                       throws javax.jms.JMSException

      Specified by:
        `recover` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### getMessageListener

          public javax.jms.MessageListener getMessageListener()
                                                       throws javax.jms.JMSException

      Specified by:
        `getMessageListener` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### setMessageListener

          public void setMessageListener(javax.jms.MessageListener listener)
                                  throws javax.jms.JMSException

      Specified by:
        `setMessageListener` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`
      Specified by:
        `run` in interface `javax.jms.Session`

    - #### createProducer

          public javax.jms.MessageProducer createProducer(javax.jms.Destination destination)
                                                   throws javax.jms.JMSException

      Specified by:
        `createProducer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createConsumer

          public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination)
                                                   throws javax.jms.JMSException

      Specified by:
        `createConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createConsumer

          public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
                                                          String messageSelector)
                                                   throws javax.jms.JMSException

      Specified by:
        `createConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createConsumer

          public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
                                                          String messageSelector,
                                                          boolean noLocal)
                                                   throws javax.jms.JMSException

      Specified by:
        `createConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createQueue

          public javax.jms.Queue createQueue(String queueName)
                                      throws javax.jms.JMSException

      Specified by:
        `createQueue` in interface `javax.jms.QueueSession`
      Specified by:
        `createQueue` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createTopic

          public javax.jms.Topic createTopic(String topicName)
                                      throws javax.jms.JMSException

      Specified by:
        `createTopic` in interface `javax.jms.Session`
      Specified by:
        `createTopic` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### createDurableSubscriber

          public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                                   String name)
                                                            throws javax.jms.JMSException

      Specified by:
        `createDurableSubscriber` in interface `javax.jms.Session`
      Specified by:
        `createDurableSubscriber` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### createDurableSubscriber

          public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                                   String name,
                                                                   String messageSelector,
                                                                   boolean noLocal)
                                                            throws javax.jms.JMSException

      Specified by:
        `createDurableSubscriber` in interface `javax.jms.Session`
      Specified by:
        `createDurableSubscriber` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### createSharedConsumer

          public javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic,
                                                                String sharedSubscriptionName)
                                                         throws javax.jms.JMSException

      Specified by:
        `createSharedConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createSharedConsumer

          public javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic,
                                                                String name,
                                                                String messageSelector)
                                                         throws javax.jms.JMSException

      Note: Needs to throw an exception if a subscriptionName is already in use by another topic, or if the messageSelector is different validate multiple subscriptions on the same session. validate multiple subscriptions on different sessions validate failure in one connection while another connection stills fine. Validate different filters in different possible scenarios
      Specified by:
        `createSharedConsumer` in interface `javax.jms.Session`
      Parameters:
        `topic` -
        `name` -
        `messageSelector` -
      Returns:
      Throws:
        `javax.jms.JMSException`

    - #### createDurableConsumer

          public javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic,
                                                                 String name)
                                                          throws javax.jms.JMSException

      Specified by:
        `createDurableConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createDurableConsumer

          public javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic,
                                                                 String name,
                                                                 String messageSelector,
                                                                 boolean noLocal)
                                                          throws javax.jms.JMSException

      Specified by:
        `createDurableConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createSharedDurableConsumer

          public javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic,
                                                                       String name)
                                                                throws javax.jms.JMSException

      Specified by:
        `createSharedDurableConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createSharedDurableConsumer

          public javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic,
                                                                       String name,
                                                                       String messageSelector)
                                                                throws javax.jms.JMSException

      Specified by:
        `createSharedDurableConsumer` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### ackAllConsumers

          public void ackAllConsumers()
                               throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### createBrowser

          public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
                                               throws javax.jms.JMSException

      Specified by:
        `createBrowser` in interface `javax.jms.QueueSession`
      Specified by:
        `createBrowser` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createBrowser

          public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue,
                                                      String filterString)
                                               throws javax.jms.JMSException

      Specified by:
        `createBrowser` in interface `javax.jms.QueueSession`
      Specified by:
        `createBrowser` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createTemporaryQueue

          public javax.jms.TemporaryQueue createTemporaryQueue()
                                                        throws javax.jms.JMSException

      Specified by:
        `createTemporaryQueue` in interface `javax.jms.QueueSession`
      Specified by:
        `createTemporaryQueue` in interface `javax.jms.Session`
      Throws:
        `javax.jms.JMSException`

    - #### createTemporaryTopic

          public javax.jms.TemporaryTopic createTemporaryTopic()
                                                        throws javax.jms.JMSException

      Specified by:
        `createTemporaryTopic` in interface `javax.jms.Session`
      Specified by:
        `createTemporaryTopic` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### unsubscribe

          public void unsubscribe(String name)
                           throws javax.jms.JMSException

      Specified by:
        `unsubscribe` in interface `javax.jms.Session`
      Specified by:
        `unsubscribe` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### getSession

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

      Throws:
        `javax.jms.JMSException`

    - #### getXAResource

          public XAResource getXAResource()

    - #### createReceiver

          public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue,
                                                        String messageSelector)
                                                 throws javax.jms.JMSException

      Specified by:
        `createReceiver` in interface `javax.jms.QueueSession`
      Throws:
        `javax.jms.JMSException`

    - #### createReceiver

          public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue)
                                                 throws javax.jms.JMSException

      Specified by:
        `createReceiver` in interface `javax.jms.QueueSession`
      Throws:
        `javax.jms.JMSException`

    - #### createSender

          public javax.jms.QueueSender createSender(javax.jms.Queue queue)
                                             throws javax.jms.JMSException

      Specified by:
        `createSender` in interface `javax.jms.QueueSession`
      Throws:
        `javax.jms.JMSException`

    - #### getQueueSession

          public javax.jms.QueueSession getQueueSession()
                                                 throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### createPublisher

          public javax.jms.TopicPublisher createPublisher(javax.jms.Topic topic)
                                                   throws javax.jms.JMSException

      Specified by:
        `createPublisher` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### createSubscriber

          public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic,
                                                            String messageSelector,
                                                            boolean noLocal)
                                                     throws javax.jms.JMSException

      Specified by:
        `createSubscriber` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### createSubscriber

          public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic)
                                                     throws javax.jms.JMSException

      Specified by:
        `createSubscriber` in interface `javax.jms.TopicSession`
      Throws:
        `javax.jms.JMSException`

    - #### getTopicSession

          public javax.jms.TopicSession getTopicSession()
                                                 throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getCoreSession

          public ClientSession getCoreSession()

    - #### isRecoverCalled

          public boolean isRecoverCalled()

    - #### setRecoverCalled

          public void setRecoverCalled(boolean recoverCalled)

    - #### deleteTemporaryTopic

          public void deleteTemporaryTopic(ActiveMQDestination tempTopic)
                                    throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### deleteTemporaryQueue

          public void deleteTemporaryQueue(ActiveMQDestination tempQueue)
                                    throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### start

          public void start()
                     throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### stop

          public void stop()
                    throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### removeConsumer

          public void removeConsumer(ActiveMQMessageConsumer consumer)

Copyright © 2017. All rights reserved.