Class SQSMessageProducer

  • All Implemented Interfaces:
    javax.jms.MessageProducer, javax.jms.QueueSender

    public class SQSMessageProducer
    extends Object
    implements javax.jms.MessageProducer, javax.jms.QueueSender
    A client uses a MessageProducer object to send messages to a queue destination. A MessageProducer object is created by passing a Destination object to a message-producer creation method supplied by a session.

    A client also has the option of creating a message producer without supplying a queue destination. In this case, a destination must be provided with every send operation.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the message producer.
      long getDeliveryDelay()
      Gets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.
      int getDeliveryMode()
      This method is not supported.
      javax.jms.Destination getDestination()
      Gets the destination associated with this MessageProducer.
      boolean getDisableMessageID()
      This method is not supported.
      boolean getDisableMessageTimestamp()
      This method is not supported.
      int getPriority()
      This method is not supported.
      javax.jms.Queue getQueue()  
      long getTimeToLive()
      This method is not supported.
      void send​(javax.jms.Destination destination, javax.jms.Message message)
      Sends a message to a queue destination.
      void send​(javax.jms.Destination destination, javax.jms.Message message, int deliveryMode, int priority, long timeToLive)
      Sends a message to a queue destination.
      void send​(javax.jms.Message message)
      Sends a message to a destination created during the creation time of this message producer.
      void send​(javax.jms.Message message, int deliveryMode, int priority, long timeToLive)
      Sends a message to a destination created during the creation time of this message producer.
      void send​(javax.jms.Queue queue, javax.jms.Message message)
      Sends a message to a queue.
      void send​(javax.jms.Queue queue, javax.jms.Message message, int deliveryMode, int priority, long timeToLive)
      Sends a message to a queue.
      void setDeliveryDelay​(long deliveryDelay)
      Sets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.
      void setDeliveryMode​(int deliveryMode)
      This method is not supported.
      void setDisableMessageID​(boolean value)
      This method is not supported.
      void setDisableMessageTimestamp​(boolean value)
      This method is not supported.
      void setPriority​(int defaultPriority)
      This method is not supported.
      void setTimeToLive​(long timeToLive)
      This method is not supported.
    • Method Detail

      • getQueue

        public javax.jms.Queue getQueue()
                                 throws javax.jms.JMSException
        Specified by:
        getQueue in interface javax.jms.QueueSender
        Throws:
        javax.jms.JMSException
      • send

        public void send​(javax.jms.Queue queue,
                         javax.jms.Message message)
                  throws javax.jms.JMSException
        Sends a message to a queue.
        Specified by:
        send in interface javax.jms.QueueSender
        Parameters:
        queue - the queue destination to send this message to
        message - the message to send
        Throws:
        javax.jms.InvalidDestinationException - If a client uses this method with a destination other than SQS queue destination.
        javax.jms.MessageFormatException - If an invalid message is specified.
        UnsupportedOperationException - If a client uses this method with a MessageProducer that specified a destination at creation time.
        javax.jms.JMSException - If session is closed or internal error.
      • send

        public void send​(javax.jms.Queue queue,
                         javax.jms.Message message,
                         int deliveryMode,
                         int priority,
                         long timeToLive)
                  throws javax.jms.JMSException
        Sends a message to a queue.

        Send does not support deliveryMode, priority, and timeToLive. It will ignore anything in deliveryMode, priority, and timeToLive.

        Specified by:
        send in interface javax.jms.QueueSender
        Parameters:
        queue - the queue destination to send this message to
        message - the message to send
        deliveryMode -
        priority -
        timeToLive -
        Throws:
        javax.jms.InvalidDestinationException - If a client uses this method with a destination other than SQS queue destination.
        javax.jms.MessageFormatException - If an invalid message is specified.
        UnsupportedOperationException - If a client uses this method with a MessageProducer that specified a destination at creation time.
        javax.jms.JMSException - If session is closed or internal error.
      • getDestination

        public javax.jms.Destination getDestination()
                                             throws javax.jms.JMSException
        Gets the destination associated with this MessageProducer.
        Specified by:
        getDestination in interface javax.jms.MessageProducer
        Returns:
        this producer's queue destination
        Throws:
        javax.jms.JMSException
      • close

        public void close()
                   throws javax.jms.JMSException
        Closes the message producer.
        Specified by:
        close in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • send

        public void send​(javax.jms.Message message)
                  throws javax.jms.JMSException
        Sends a message to a destination created during the creation time of this message producer.
        Specified by:
        send in interface javax.jms.MessageProducer
        Specified by:
        send in interface javax.jms.QueueSender
        Parameters:
        message - the message to send
        Throws:
        javax.jms.MessageFormatException - If an invalid message is specified.
        UnsupportedOperationException - If a client uses this method with a MessageProducer that did not specify a destination at creation time.
        javax.jms.JMSException - If session is closed or internal error.
      • send

        public void send​(javax.jms.Message message,
                         int deliveryMode,
                         int priority,
                         long timeToLive)
                  throws javax.jms.JMSException
        Sends a message to a destination created during the creation time of this message producer.

        Send does not support deliveryMode, priority, and timeToLive. It will ignore anything in deliveryMode, priority, and timeToLive.

        Specified by:
        send in interface javax.jms.MessageProducer
        Specified by:
        send in interface javax.jms.QueueSender
        Parameters:
        message - the message to send
        deliveryMode -
        priority -
        timeToLive -
        Throws:
        javax.jms.MessageFormatException - If an invalid message is specified.
        UnsupportedOperationException - If a client uses this method with a MessageProducer that did not specify a destination at creation time.
        javax.jms.JMSException - If session is closed or internal error.
      • send

        public void send​(javax.jms.Destination destination,
                         javax.jms.Message message)
                  throws javax.jms.JMSException
        Sends a message to a queue destination.
        Specified by:
        send in interface javax.jms.MessageProducer
        Parameters:
        destination - the queue destination to send this message to
        message - the message to send
        Throws:
        javax.jms.InvalidDestinationException - If a client uses this method with a destination other than valid SQS queue destination.
        javax.jms.MessageFormatException - If an invalid message is specified.
        UnsupportedOperationException - If a client uses this method with a MessageProducer that specified a destination at creation time.
        javax.jms.JMSException - If session is closed or internal error.
      • send

        public void send​(javax.jms.Destination destination,
                         javax.jms.Message message,
                         int deliveryMode,
                         int priority,
                         long timeToLive)
                  throws javax.jms.JMSException
        Sends a message to a queue destination.

        Send does not support deliveryMode, priority, and timeToLive. It will ignore anything in deliveryMode, priority, and timeToLive.

        Specified by:
        send in interface javax.jms.MessageProducer
        Parameters:
        destination - the queue destination to send this message to
        message - the message to send
        deliveryMode -
        priority -
        timeToLive -
        Throws:
        javax.jms.InvalidDestinationException - If a client uses this method with a destination other than valid SQS queue destination.
        javax.jms.MessageFormatException - If an invalid message is specified.
        UnsupportedOperationException - If a client uses this method with a MessageProducer that specified a destination at creation time.
        javax.jms.JMSException - If session is closed or internal error.
      • setDisableMessageID

        public void setDisableMessageID​(boolean value)
                                 throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        setDisableMessageID in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • getDisableMessageID

        public boolean getDisableMessageID()
                                    throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        getDisableMessageID in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • setDisableMessageTimestamp

        public void setDisableMessageTimestamp​(boolean value)
                                        throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        setDisableMessageTimestamp in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • getDisableMessageTimestamp

        public boolean getDisableMessageTimestamp()
                                           throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        getDisableMessageTimestamp in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • setDeliveryMode

        public void setDeliveryMode​(int deliveryMode)
                             throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        setDeliveryMode in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • getDeliveryMode

        public int getDeliveryMode()
                            throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        getDeliveryMode in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • setPriority

        public void setPriority​(int defaultPriority)
                         throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        setPriority in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • getPriority

        public int getPriority()
                        throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        getPriority in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • setTimeToLive

        public void setTimeToLive​(long timeToLive)
                           throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        setTimeToLive in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • getTimeToLive

        public long getTimeToLive()
                           throws javax.jms.JMSException
        This method is not supported.
        Specified by:
        getTimeToLive in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
      • setDeliveryDelay

        public void setDeliveryDelay​(long deliveryDelay)
        Sets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.

        This must be a multiple of 1000, since SQS only supports delivery delays in seconds.

      • getDeliveryDelay

        public long getDeliveryDelay()
        Gets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.