Package com.amazon.sqs.javamessaging
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 TypeMethodDescriptionvoid
close()
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
getQueue()
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
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 Details
-
getQueue
public jakarta.jms.Queue getQueue() throws jakarta.jms.JMSException- Specified by:
getQueue
in interfacejakarta.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 interfacejakarta.jms.QueueSender
- Parameters:
queue
- the queue destination to send this message tomessage
- 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 interfacejakarta.jms.QueueSender
- Parameters:
queue
- the queue destination to send this message tomessage
- the message to senddeliveryMode
-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.JMSExceptionGets the destination associated with this MessageProducer.- Specified by:
getDestination
in interfacejakarta.jms.MessageProducer
- Returns:
- this producer's queue destination
- Throws:
jakarta.jms.JMSException
-
close
public void close() throws jakarta.jms.JMSExceptionCloses the message producer.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Specified by:
send
in interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Specified by:
send
in interfacejakarta.jms.QueueSender
- Parameters:
message
- the message to senddeliveryMode
-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 interfacejakarta.jms.MessageProducer
- Parameters:
destination
- the queue destination to send this message tomessage
- 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 interfacejakarta.jms.MessageProducer
- Parameters:
destination
- the queue destination to send this message tomessage
- the message to senddeliveryMode
-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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Throws:
jakarta.jms.JMSException
-
getDisableMessageID
public boolean getDisableMessageID() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getDisableMessageID
in interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Throws:
jakarta.jms.JMSException
-
getDisableMessageTimestamp
public boolean getDisableMessageTimestamp() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getDisableMessageTimestamp
in interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Throws:
jakarta.jms.JMSException
-
getDeliveryMode
public int getDeliveryMode() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getDeliveryMode
in interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Throws:
jakarta.jms.JMSException
-
getPriority
public int getPriority() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getPriority
in interfacejakarta.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 interfacejakarta.jms.MessageProducer
- Throws:
jakarta.jms.JMSException
-
getTimeToLive
public long getTimeToLive() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getTimeToLive
in interfacejakarta.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 interfacejakarta.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 interfacejakarta.jms.MessageProducer
-