Class SQSMessageProducer

java.lang.Object
com.amazon.sqs.javamessaging.SQSMessageProducer
All Implemented Interfaces:
jakarta.jms.MessageProducer, jakarta.jms.QueueSender, AutoCloseable

public class SQSMessageProducer extends Object implements jakarta.jms.MessageProducer, jakarta.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

    Modifier and Type
    Method
    Description
    void
    Closes the message producer.
    long
    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
    This method is not supported.
    jakarta.jms.Destination
    Gets the destination associated with this MessageProducer.
    boolean
    This method is not supported.
    boolean
    This method is not supported.
    int
    This method is not supported.
    jakarta.jms.Queue
     
    long
    This method is not supported.
    void
    send(jakarta.jms.Destination destination, jakarta.jms.Message message)
    Sends a message to a queue destination.
    void
    send(jakarta.jms.Destination destination, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive)
    Sends a message to a queue destination.
    void
    send(jakarta.jms.Destination destination, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive, jakarta.jms.CompletionListener completionListener)
     
    void
    send(jakarta.jms.Destination destination, jakarta.jms.Message message, jakarta.jms.CompletionListener completionListener)
     
    void
    send(jakarta.jms.Message message)
    Sends a message to a destination created during the creation time of this message producer.
    void
    send(jakarta.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(jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive, jakarta.jms.CompletionListener completionListener)
     
    void
    send(jakarta.jms.Message message, jakarta.jms.CompletionListener completionListener)
     
    void
    send(jakarta.jms.Queue queue, jakarta.jms.Message message)
    Sends a message to a queue.
    void
    send(jakarta.jms.Queue queue, jakarta.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
    This method is not supported.
    void
    setPriority(int defaultPriority)
    This method is not supported.
    void
    setTimeToLive(long timeToLive)
    This method is not supported.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getQueue

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

      public void send(jakarta.jms.Queue queue, jakarta.jms.Message message) throws jakarta.jms.JMSException
      Sends a message to a queue.
      Specified by:
      send in interface jakarta.jms.QueueSender
      Parameters:
      queue - the queue destination to send this message to
      message - the message to send
      Throws:
      jakarta.jms.InvalidDestinationException - If a client uses this method with a destination other than SQS queue destination.
      jakarta.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.
      jakarta.jms.JMSException - If session is closed or internal error.
    • send

      public void send(jakarta.jms.Queue queue, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive) throws jakarta.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 jakarta.jms.QueueSender
      Parameters:
      queue - the queue destination to send this message to
      message - the message to send
      deliveryMode -
      priority -
      timeToLive -
      Throws:
      jakarta.jms.InvalidDestinationException - If a client uses this method with a destination other than SQS queue destination.
      jakarta.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.
      jakarta.jms.JMSException - If session is closed or internal error.
    • getDestination

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

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

      public void send(jakarta.jms.Message message) throws jakarta.jms.JMSException
      Sends a message to a destination created during the creation time of this message producer.
      Specified by:
      send in interface jakarta.jms.MessageProducer
      Specified by:
      send in interface jakarta.jms.QueueSender
      Parameters:
      message - the message to send
      Throws:
      jakarta.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.
      jakarta.jms.JMSException - If session is closed or internal error.
    • send

      public void send(jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive) throws jakarta.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 jakarta.jms.MessageProducer
      Specified by:
      send in interface jakarta.jms.QueueSender
      Parameters:
      message - the message to send
      deliveryMode -
      priority -
      timeToLive -
      Throws:
      jakarta.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.
      jakarta.jms.JMSException - If session is closed or internal error.
    • send

      public void send(jakarta.jms.Destination destination, jakarta.jms.Message message) throws jakarta.jms.JMSException
      Sends a message to a queue destination.
      Specified by:
      send in interface jakarta.jms.MessageProducer
      Parameters:
      destination - the queue destination to send this message to
      message - the message to send
      Throws:
      jakarta.jms.InvalidDestinationException - If a client uses this method with a destination other than valid SQS queue destination.
      jakarta.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.
      jakarta.jms.JMSException - If session is closed or internal error.
    • send

      public void send(jakarta.jms.Destination destination, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive) throws jakarta.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 jakarta.jms.MessageProducer
      Parameters:
      destination - the queue destination to send this message to
      message - the message to send
      deliveryMode -
      priority -
      timeToLive -
      Throws:
      jakarta.jms.InvalidDestinationException - If a client uses this method with a destination other than valid SQS queue destination.
      jakarta.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.
      jakarta.jms.JMSException - If session is closed or internal error.
    • send

      public void send(jakarta.jms.Message message, jakarta.jms.CompletionListener completionListener) throws jakarta.jms.JMSException
      Specified by:
      send in interface jakarta.jms.MessageProducer
      Throws:
      jakarta.jms.JMSException
    • send

      public void send(jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive, jakarta.jms.CompletionListener completionListener) throws jakarta.jms.JMSException
      Specified by:
      send in interface jakarta.jms.MessageProducer
      Throws:
      jakarta.jms.JMSException
    • send

      public void send(jakarta.jms.Destination destination, jakarta.jms.Message message, jakarta.jms.CompletionListener completionListener) throws jakarta.jms.JMSException
      Specified by:
      send in interface jakarta.jms.MessageProducer
      Throws:
      jakarta.jms.JMSException
    • send

      public void send(jakarta.jms.Destination destination, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive, jakarta.jms.CompletionListener completionListener) throws jakarta.jms.JMSException
      Specified by:
      send in interface jakarta.jms.MessageProducer
      Throws:
      jakarta.jms.JMSException
    • setDisableMessageID

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

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

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

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

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

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

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

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

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

      public long getTimeToLive() throws jakarta.jms.JMSException
      This method is not supported.
      Specified by:
      getTimeToLive in interface jakarta.jms.MessageProducer
      Throws:
      jakarta.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.

      Specified by:
      setDeliveryDelay in interface jakarta.jms.MessageProducer
    • 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.
      Specified by:
      getDeliveryDelay in interface jakarta.jms.MessageProducer