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 TypeMethodDescriptionvoidclose()Closes the message producer.longGets 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.intThis method is not supported.jakarta.jms.DestinationGets the destination associated with this MessageProducer.booleanThis method is not supported.booleanThis method is not supported.intThis method is not supported.jakarta.jms.QueuegetQueue()longThis method is not supported.voidsend(jakarta.jms.Destination destination, jakarta.jms.Message message) Sends a message to a queue destination.voidsend(jakarta.jms.Destination destination, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive) Sends a message to a queue destination.voidsend(jakarta.jms.Destination destination, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive, jakarta.jms.CompletionListener completionListener) voidsend(jakarta.jms.Destination destination, jakarta.jms.Message message, jakarta.jms.CompletionListener completionListener) voidsend(jakarta.jms.Message message) Sends a message to a destination created during the creation time of this message producer.voidsend(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.voidsend(jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive, jakarta.jms.CompletionListener completionListener) voidsend(jakarta.jms.Message message, jakarta.jms.CompletionListener completionListener) voidsend(jakarta.jms.Queue queue, jakarta.jms.Message message) Sends a message to a queue.voidsend(jakarta.jms.Queue queue, jakarta.jms.Message message, int deliveryMode, int priority, long timeToLive) Sends a message to a queue.voidsetDeliveryDelay(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.voidsetDeliveryMode(int deliveryMode) This method is not supported.voidsetDisableMessageID(boolean value) This method is not supported.voidsetDisableMessageTimestamp(boolean value) This method is not supported.voidsetPriority(int defaultPriority) This method is not supported.voidsetTimeToLive(long timeToLive) This method is not supported.
-
Method Details
-
getQueue
public jakarta.jms.Queue getQueue() throws jakarta.jms.JMSException- Specified by:
getQueuein 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:
sendin 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:
sendin 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:
getDestinationin 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:
closein interfaceAutoCloseable- Specified by:
closein 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:
sendin interfacejakarta.jms.MessageProducer- Specified by:
sendin 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:
sendin interfacejakarta.jms.MessageProducer- Specified by:
sendin 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:
sendin 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:
sendin 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:
sendin 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:
sendin 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:
sendin 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:
sendin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
setDisableMessageID
public void setDisableMessageID(boolean value) throws jakarta.jms.JMSException This method is not supported.- Specified by:
setDisableMessageIDin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
getDisableMessageID
public boolean getDisableMessageID() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getDisableMessageIDin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
setDisableMessageTimestamp
public void setDisableMessageTimestamp(boolean value) throws jakarta.jms.JMSException This method is not supported.- Specified by:
setDisableMessageTimestampin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
getDisableMessageTimestamp
public boolean getDisableMessageTimestamp() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getDisableMessageTimestampin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
setDeliveryMode
public void setDeliveryMode(int deliveryMode) throws jakarta.jms.JMSException This method is not supported.- Specified by:
setDeliveryModein interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
getDeliveryMode
public int getDeliveryMode() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getDeliveryModein interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
setPriority
public void setPriority(int defaultPriority) throws jakarta.jms.JMSException This method is not supported.- Specified by:
setPriorityin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
getPriority
public int getPriority() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getPriorityin interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
setTimeToLive
public void setTimeToLive(long timeToLive) throws jakarta.jms.JMSException This method is not supported.- Specified by:
setTimeToLivein interfacejakarta.jms.MessageProducer- Throws:
jakarta.jms.JMSException
-
getTimeToLive
public long getTimeToLive() throws jakarta.jms.JMSExceptionThis method is not supported.- Specified by:
getTimeToLivein 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:
setDeliveryDelayin 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:
getDeliveryDelayin interfacejakarta.jms.MessageProducer
-