Class QueueSession

  • All Implemented Interfaces:
    jakarta.jms.QueueSession, jakarta.jms.Session, AutoCloseable, Runnable, SessionMBean

    public class QueueSession
    extends Session
    implements jakarta.jms.QueueSession
    Implements the jakarta.jms.QueueSession interface.
    • Constructor Detail

      • QueueSession

        QueueSession​(Connection cnx,
                     boolean transacted,
                     int acknowledgeMode,
                     RequestMultiplexer mtpx)
              throws jakarta.jms.JMSException
        Constructs a queue session.
        Parameters:
        cnx - The connection the session belongs to.
        transacted - true for a transacted session.
        acknowledgeMode - 1 (auto), 2 (client) or 3 (dups ok).
        Throws:
        jakarta.jms.JMSException - In case of an invalid acknowledge mode.
    • Method Detail

      • createSender

        public jakarta.jms.QueueSender createSender​(jakarta.jms.Queue queue)
                                             throws jakarta.jms.JMSException
        API method. Creates a QueueSender object to send messages to the specified queue.
        Specified by:
        createSender in interface jakarta.jms.QueueSession
        Parameters:
        queue - the queue to send to, or null if this is a sender which does not have a specified destination.
        Returns:
        the created QueueSender object.
        Throws:
        jakarta.jms.IllegalStateException - If the session is closed or if the connection is broken.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createReceiver

        public jakarta.jms.QueueReceiver createReceiver​(jakarta.jms.Queue queue,
                                                        String selector)
                                                 throws jakarta.jms.JMSException
        API method. Creates a QueueReceiver object to receive messages from the specified queue using a message selector.
        Specified by:
        createReceiver in interface jakarta.jms.QueueSession
        Parameters:
        queue - the queue to access.
        selector - The selector allowing to filter messages.
        Returns:
        the created QueueReceiver object.
        Throws:
        jakarta.jms.IllegalStateException - If the session is closed or if the connection is broken.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createReceiver

        public jakarta.jms.QueueReceiver createReceiver​(jakarta.jms.Queue queue)
                                                 throws jakarta.jms.JMSException
        API method. Creates a QueueReceiver object to receive messages from the specified queue.
        Specified by:
        createReceiver in interface jakarta.jms.QueueSession
        Parameters:
        queue - the queue to access.
        Returns:
        the created QueueReceiver object.
        Throws:
        jakarta.jms.IllegalStateException - If the session is closed or if the connection is broken.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createDurableSubscriber

        public jakarta.jms.TopicSubscriber createDurableSubscriber​(jakarta.jms.Topic topic,
                                                                   String name,
                                                                   String selector,
                                                                   boolean noLocal)
                                                            throws jakarta.jms.JMSException
        API method.
        Specified by:
        createDurableSubscriber in interface jakarta.jms.Session
        Overrides:
        createDurableSubscriber in class Session
        Parameters:
        topic - the non-temporary Topic to subscribe to.
        name - the name used to identify this subscription.
        selector - The selector allowing to filter messages. A value of null or an empty string indicates that there is no message selector for the message consumer.
        noLocal - if true, inhibits the delivery of messages published by its own connection.
        Returns:
        the created TopicSubscriber object.
        Throws:
        jakarta.jms.IllegalStateException - Systematically.
        jakarta.jms.InvalidDestinationException - if an invalid destination is specified.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createDurableSubscriber

        public jakarta.jms.TopicSubscriber createDurableSubscriber​(jakarta.jms.Topic topic,
                                                                   String name)
                                                            throws jakarta.jms.JMSException
        API method.
        Specified by:
        createDurableSubscriber in interface jakarta.jms.Session
        Overrides:
        createDurableSubscriber in class Session
        Parameters:
        topic - the non-temporary Topic to subscribe to.
        name - the name used to identify this subscription.
        Returns:
        the created TopicSubscriber object.
        Throws:
        jakarta.jms.IllegalStateException - Systematically.
        jakarta.jms.InvalidDestinationException - if an invalid destination is specified.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createTopic

        public jakarta.jms.Topic createTopic​(String topicName)
                                      throws jakarta.jms.JMSException
        API method.
        Specified by:
        createTopic in interface jakarta.jms.Session
        Overrides:
        createTopic in class Session
        Parameters:
        topicName - the name of this topic.
        Returns:
        a topic with the given name.
        Throws:
        jakarta.jms.IllegalStateException - Systematically.
        jakarta.jms.JMSException - If the topic creation failed.
        See Also:
        Topic
      • createTemporaryTopic

        public jakarta.jms.TemporaryTopic createTemporaryTopic()
                                                        throws jakarta.jms.JMSException
        API method.
        Specified by:
        createTemporaryTopic in interface jakarta.jms.Session
        Overrides:
        createTemporaryTopic in class Session
        Returns:
        a temporary topic identity.
        Throws:
        jakarta.jms.IllegalStateException - Systematically.
        jakarta.jms.JMSException - If the request fails for any other reason.
        See Also:
        TemporaryTopic
      • unsubscribe

        public void unsubscribe​(String name)
                         throws jakarta.jms.JMSException
        API method.
        Specified by:
        unsubscribe in interface jakarta.jms.Session
        Specified by:
        unsubscribe in interface SessionMBean
        Overrides:
        unsubscribe in class Session
        Parameters:
        name - the name used to identify this subscription.
        Throws:
        jakarta.jms.IllegalStateException - Systematically.
        jakarta.jms.InvalidDestinationException - If the subscription does not exist.
        jakarta.jms.JMSException - If the request fails for any other reason.
      • createSharedConsumer

        public jakarta.jms.MessageConsumer createSharedConsumer​(jakarta.jms.Topic topic,
                                                                String name)
                                                         throws jakarta.jms.JMSException
        API 2.0 method.
        Specified by:
        createSharedConsumer in interface jakarta.jms.Session
        Overrides:
        createSharedConsumer in class Session
        Throws:
        jakarta.jms.JMSException
      • createSharedConsumer

        public jakarta.jms.MessageConsumer createSharedConsumer​(jakarta.jms.Topic topic,
                                                                String name,
                                                                String selector)
                                                         throws jakarta.jms.JMSException
        API 2.0 method.
        Specified by:
        createSharedConsumer in interface jakarta.jms.Session
        Overrides:
        createSharedConsumer in class Session
        Throws:
        jakarta.jms.JMSException
      • createDurableConsumer

        public jakarta.jms.MessageConsumer createDurableConsumer​(jakarta.jms.Topic topic,
                                                                 String name)
                                                          throws jakarta.jms.JMSException
        API 2.0 method.
        Specified by:
        createDurableConsumer in interface jakarta.jms.Session
        Overrides:
        createDurableConsumer in class Session
        Parameters:
        topic - the non-temporary Topic to subscribe to.
        name - the name used to identify this subscription.
        Returns:
        the created MessageConsumer object.
        Throws:
        jakarta.jms.InvalidDestinationException - if an invalid destination is specified.
        jakarta.jms.IllegalStateException - If the session is closed or if the connection is broken or if the client identifier is unset.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createDurableConsumer

        public jakarta.jms.MessageConsumer createDurableConsumer​(jakarta.jms.Topic topic,
                                                                 String name,
                                                                 String messageSelector,
                                                                 boolean noLocal)
                                                          throws jakarta.jms.JMSException
        API 2.0 method.
        Specified by:
        createDurableConsumer in interface jakarta.jms.Session
        Overrides:
        createDurableConsumer in class Session
        Parameters:
        topic - the non-temporary Topic to subscribe to.
        name - the name used to identify this subscription.
        messageSelector - the selector used to filter incoming messages.
        noLocal - if true, inhibits the delivery of messages published by its own connection.
        Returns:
        the created MessageConsumer object.
        Throws:
        jakarta.jms.InvalidDestinationException - if an invalid destination is specified.
        jakarta.jms.IllegalStateException - If the session is closed or if the connection is broken or if the client identifier is unset.
        jakarta.jms.JMSException - If the creation fails for any other reason.
      • createSharedDurableConsumer

        public jakarta.jms.MessageConsumer createSharedDurableConsumer​(jakarta.jms.Topic topic,
                                                                       String name)
                                                                throws jakarta.jms.JMSException
        API 2.0 method.
        Specified by:
        createSharedDurableConsumer in interface jakarta.jms.Session
        Overrides:
        createSharedDurableConsumer in class Session
        Throws:
        jakarta.jms.JMSException
      • createSharedDurableConsumer

        public jakarta.jms.MessageConsumer createSharedDurableConsumer​(jakarta.jms.Topic topic,
                                                                       String name,
                                                                       String selector)
                                                                throws jakarta.jms.JMSException
        API 2.0 method.
        Specified by:
        createSharedDurableConsumer in interface jakarta.jms.Session
        Overrides:
        createSharedDurableConsumer in class Session
        Throws:
        jakarta.jms.JMSException