Class QueueSender

  • All Implemented Interfaces:
    jakarta.jms.MessageProducer, jakarta.jms.QueueSender, AutoCloseable

    public class QueueSender
    extends MessageProducer
    implements jakarta.jms.QueueSender
    Implements the jakarta.jms.QueueSender interface.
    • Constructor Detail

      • QueueSender

        QueueSender​(QueueSession sess,
                    Destination queue)
             throws jakarta.jms.JMSException
        Constructs a sender.
        Parameters:
        sess - The session the sender belongs to.
        queue - The queue the sender sends messages to.
        Throws:
        jakarta.jms.IllegalStateException - If the connection is broken.
        jakarta.jms.JMSException - If the creation fails for any other reason.
    • Method Detail

      • toString

        public String toString()
        Returns a string view of this receiver.
        Overrides:
        toString in class Object
      • getQueue

        public jakarta.jms.Queue getQueue()
                                   throws jakarta.jms.JMSException
        API method. Gets the queue associated with this queue sender.
        Specified by:
        getQueue in interface jakarta.jms.QueueSender
        Returns:
        this sender's Queue.
        Throws:
        jakarta.jms.IllegalStateException - If the sender is closed.
        jakarta.jms.JMSException
      • send

        public void send​(jakarta.jms.Queue queue,
                         jakarta.jms.Message message)
                  throws jakarta.jms.JMSException
        API method. Sends a message to a queue for an unidentified queue sender with default delivery parameters.

        Typically, a queue sender is assigned a queue at creation time; however, the JMS API also supports unidentified queue sender, which require that the queue be supplied every time a message is sent.

        Specified by:
        send in interface jakarta.jms.QueueSender
        Parameters:
        queue - the queue to send this message to.
        message - the message to send.
        Throws:
        UnsupportedOperationException - When the sender did not properly identify itself.
        JMSSecurityException - If the user if not a WRITER on the specified queue.
        jakarta.jms.IllegalStateException - If the sender is closed, or if the connection is broken.
        jakarta.jms.JMSException - If the request fails for any other reason.
      • send

        public void send​(jakarta.jms.Queue queue,
                         jakarta.jms.Message message,
                         int deliveryMode,
                         int priority,
                         long timeToLive)
                  throws jakarta.jms.JMSException
        API method. Sends a message to a queue for an unidentified queue sender with given delivery parameters.

        Typically, a queue sender is assigned a queue at creation time; however, the JMS API also supports unidentified queue sender, which require that the queue be supplied every time a message is sent.

        Specified by:
        send in interface jakarta.jms.QueueSender
        Parameters:
        queue - the queue to send this message to.
        message - the message to send.
        deliveryMode - the delivery mode to use.
        priority - the priority for this message.
        timeToLive - the message's lifetime in milliseconds.
        Throws:
        UnsupportedOperationException - When the sender did not properly identify itself.
        JMSSecurityException - If the user if not a WRITER on the specified queue.
        jakarta.jms.IllegalStateException - If the sender is closed, or if the connection is broken.
        jakarta.jms.JMSException - If the request fails for any other reason.