Class Queue

  • All Implemented Interfaces:
    jakarta.jms.Destination, jakarta.jms.Queue, Serializable, Referenceable, DestinationMBean, QueueMBean
    Direct Known Subclasses:
    TemporaryQueue

    public class Queue
    extends Destination
    implements jakarta.jms.Queue, QueueMBean
    Implements the jakarta.jms.Queue interface.

    This is a proxy object a client uses to specify the destination of messages it is sending and the source of messages it receives.

    The Queue class is a factory for Joram's Queue destination through the create static methods, the Queue object provides Joram specific administration and monitoring methods.

    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        define serialVersionUID for interoperability
        See Also:
        Constant Field Values
      • REDELIVERY_DELAY

        public static final String REDELIVERY_DELAY
        Property allowing to fix RedeliveryDelay
        See Also:
        Constant Field Values
    • Constructor Detail

      • Queue

        public Queue()
      • Queue

        public Queue​(String name)
      • Queue

        protected Queue​(String name,
                        byte type)
    • Method Detail

      • toString

        public String toString()
        Returns a String image of the queue.
        Specified by:
        toString in interface jakarta.jms.Queue
        Overrides:
        toString in class Object
        Returns:
        A provider-specific identity values for this queue.
      • getQueueName

        public String getQueueName()
                            throws jakarta.jms.JMSException
        API method. Gets the The Joram's internal unique identifier of this queue.
        Specified by:
        getQueueName in interface jakarta.jms.Queue
        Returns:
        The Joram's internal unique identifier.
        Throws:
        jakarta.jms.JMSException - Actually never thrown.
      • create

        public static Queue create()
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying a queue on the local server.

        The request fails if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • create

        public static Queue create​(int serverId)
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying a queue on a given server.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • create

        public static Queue create​(String name)
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying (or retrieving) a queue on the local server. First a destination with the specified name is searched on the given server, if it does not exist it is created. In any case, its provider-specific address is returned.

        The request fails if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        name - The queue name.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • create

        public static Queue create​(int serverId,
                                   String name)
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying (or retrieving) a queue on a given server with a given name. First a destination with the specified name is searched on the given server, if it does not exist it is created. In any case, its provider-specific address is returned.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        name - The queue name.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • create

        public static Queue create​(int serverId,
                                   Properties prop)
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying a queue on a given server. It creates a Joram's standard queue.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        prop - The queue properties.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • create

        public static Queue create​(int serverId,
                                   String className,
                                   Properties prop)
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying a queue on a given server.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        className - The queue class name.
        prop - The queue properties.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • create

        public static Queue create​(int serverId,
                                   String name,
                                   String className,
                                   Properties prop)
                            throws ConnectException,
                                   AdminException
        Administration method creating and deploying (or retrieving) a queue on a given server. First a destination with the specified name is searched on the given server, if it does not exist it is created. In any case, its provider-specific address is returned.

        The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

        Be careful this method use the static AdminModule connection.

        Parameters:
        serverId - The identifier of the server where deploying the queue.
        name - The name of the queue.
        className - The MOM's queue class name.
        prop - The queue properties.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • setThreshold

        public void setThreshold​(int threshold)
                          throws ConnectException,
                                 AdminException
        Administration method setting or unsetting the threshold for this queue.

        The request fails if the queue is deleted server side.

        Specified by:
        setThreshold in interface QueueMBean
        Parameters:
        threshold - The threshold value to be set (-1 for unsetting previous value).
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • setNbMaxMsg

        public void setNbMaxMsg​(int nbMaxMsg)
                         throws ConnectException,
                                AdminException
        Administration method setting nbMaxMsg for this queue.

        The request fails if the queue is deleted server side.

        Specified by:
        setNbMaxMsg in interface QueueMBean
        Parameters:
        nbMaxMsg - nb Max of Message (-1 no limit).
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • setSyncExceptionOnFull

        public void setSyncExceptionOnFull​(boolean syncExceptionOnFull)
                                    throws ConnectException,
                                           AdminException
        Administration method setting syncExceptionOnFull for this queue.

        The request fails if the queue is deleted server side.

        Parameters:
        syncExceptionOnFull - true, throws an exception on sending message on full destination.
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • getDeliveredMessages

        public int getDeliveredMessages()
                                 throws ConnectException,
                                        AdminException
        Monitoring method returning the number of delivered messages since the queue's creation.

        The request fails if the queue is deleted server side.

        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • readMessage

        public jakarta.jms.Message readMessage​(String msgId)
                                        throws AdminException,
                                               ConnectException,
                                               jakarta.jms.JMSException
        Deprecated.
        Since Joram 5.2 use getMessage.
        Returns a copy of the message.
        Parameters:
        msgId - The identifier of the message.
        Returns:
        The message
        Throws:
        AdminException
        ConnectException
        jakarta.jms.JMSException
      • addClusteredQueue

        public void addClusteredQueue​(Queue addedQueue)
                               throws ConnectException,
                                      AdminException
        Adds a queue into the cluster this queue belongs to. If this queue doesn't belong to a cluster then a cluster is created by clustering this queue with the added queue.

        The request fails if one or both of the queues are deleted, or can't belong to a cluster.

        Parameters:
        addedQueue - queue added to the cluster
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • removeClusteredQueue

        public void removeClusteredQueue​(Queue removedQueue)
                                  throws ConnectException,
                                         AdminException
        Deprecated.
        Removes a queue from the cluster this queue belongs to.

        The request fails if the queue does not exist or is not part of any cluster.

        Parameters:
        removedQueue - queue removed from the cluster
        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • removeFromCluster

        public void removeFromCluster()
                               throws ConnectException,
                                      AdminException
        Removes this queue from the cluster it belongs to.

        The request fails if the queue does not exist or is not part of any cluster.

        Throws:
        ConnectException - If the admin connection is closed or broken.
        AdminException - If the request fails.
      • registerAsDefaultDMQ

        public void registerAsDefaultDMQ​(int serverId)
                                  throws ConnectException,
                                         AdminException
        Sets the current queue as the default DMQ for the given server.

        The request fails if the target server does not belong to the platform.

        Specified by:
        registerAsDefaultDMQ in interface QueueMBean
        Parameters:
        serverId - The identifier of the server.
        Throws:
        ConnectException - If the connection fails.
        AdminException - If the request fails.
      • setPause

        public void setPause​(boolean pause)
                      throws ConnectException,
                             AdminException
        Stops / Resumes the message delivery.
        Parameters:
        pause - if true stops the message delivery, else resumes it.
        Throws:
        ConnectException - If the administration connection is closed or broken.
        AdminException - If the request fails.