Class SQSMessage
- java.lang.Object
-
- com.amazon.sqs.javamessaging.message.SQSMessage
-
- All Implemented Interfaces:
javax.jms.Message
- Direct Known Subclasses:
SQSBytesMessage
,SQSObjectMessage
,SQSTextMessage
public class SQSMessage extends Object implements javax.jms.Message
The SQSMessage is the root class of all SQS JMS messages and implements JMS Message interface.Not all message headers are supported at this time:
JMSMessageID
is always assigned as SQS provided message id.JMSRedelivered
is set to true if SQS delivers the message more than once. This not necessarily mean that the user received message more than once, but rather SQS attempted to deliver it more than once. Due to prefetching used inSQSMessageConsumerPrefetch
, this can be set to true although user never received the message. This is set based on SQS ApproximateReceiveCount attributeJMSDestination
is the destination object which message
is sent to and received from.
JMSXDeliveryCount reserved property is supported and set based on the approximate receive count observed on the SQS side.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SQSMessage.JMSMessagePropertyValue
This class is used fulfill object value, corresponding SQS message attribute type and message attribute string value.static class
SQSMessage.TypeConversionSupport
Copied from org.apache.activemq.util.TypeConversionSupport to provide the same property support provided by activemq without creating a dependency on activemq.
-
Field Summary
Fields Modifier and Type Field Description static String
BYTE_MESSAGE_TYPE
static String
JMS_SQS_CORRELATION_ID
static String
JMS_SQS_MESSAGE_TYPE
static String
JMS_SQS_REPLY_TO_QUEUE_NAME
static String
JMS_SQS_REPLY_TO_QUEUE_URL
static String
OBJECT_MESSAGE_TYPE
static String
TEXT_MESSAGE_TYPE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledge()
Acknowledges message(s).protected void
checkBodyWritePermissions()
protected void
checkPropertyWritePermissions()
void
clearBody()
Clears out the message body.void
clearProperties()
Clears a message's properties and set the write permissions for properties.protected static javax.jms.JMSException
convertExceptionToJMSException(Exception e)
protected static javax.jms.MessageFormatException
convertExceptionToMessageFormatException(Exception e)
boolean
getBooleanProperty(String name)
Returns the value of theboolean
property with the specified name.byte
getByteProperty(String name)
Returns the value of thebyte
property with the specified name.double
getDoubleProperty(String name)
Returns the value of thedouble
property with the specified name.float
getFloatProperty(String name)
Returns the value of thefloat
property with the specified name.int
getIntProperty(String name)
Returns the value of theint
property with the specified name.String
getJMSCorrelationID()
byte[]
getJMSCorrelationIDAsBytes()
int
getJMSDeliveryMode()
javax.jms.Destination
getJMSDestination()
Gets the Destination object for this message.long
getJMSExpiration()
String
getJMSMessageID()
Gets the message ID.SQSMessage.JMSMessagePropertyValue
getJMSMessagePropertyValue(String name)
Returns the property value with message attribute to object property conversions took place.int
getJMSPriority()
boolean
getJMSRedelivered()
javax.jms.Destination
getJMSReplyTo()
long
getJMSTimestamp()
String
getJMSType()
long
getLongProperty(String name)
Returns the value of thelong
property with the specified name.Object
getObjectProperty(String name)
Returns the value of the Java object property with the specified name.Enumeration<String>
getPropertyNames()
Returns anEnumeration
of all the property names.String
getQueueUrl()
Get queueUrl the message came from.String
getReceiptHandle()
Get SQS Message receiptHandle.short
getShortProperty(String name)
Returns the value of theshort
property with the specified name.String
getSQSMessageDeduplicationId()
Get SQS Message Deduplication Id (applicable for FIFO queues, available also as JMS property 'JMS_SQS_DeduplicationId')String
getSQSMessageGroupId()
Get SQS Message Group Id (applicable for FIFO queues, available also as JMS property 'JMSXGroupId')String
getSQSMessageId()
Get SQS Message Id.String
getSQSMessageSequenceNumber()
Get SQS Message Sequence Number (applicable for FIFO queues, available also as JMS property 'JMS_SQS_SequenceNumber')String
getStringProperty(String name)
Returns the value of theString
property with the specified name.boolean
propertyExists(String name)
Indicates whether a property value exists for the given property name.protected void
setBodyWritePermissions(boolean enable)
void
setBooleanProperty(String name, boolean value)
Sets aboolean
property value with the specified name into the message.void
setByteProperty(String name, byte value)
Sets abyte
property value with the specified name into the message.void
setDoubleProperty(String name, double value)
Sets adouble
property value with the specified name into the message.void
setFloatProperty(String name, float value)
Sets afloat
property value with the specified name into the message.void
setIntProperty(String name, int value)
Sets aint
property value with the specified name into the message.void
setJMSCorrelationID(String correlationID)
void
setJMSCorrelationIDAsBytes(byte[] correlationID)
void
setJMSDeliveryMode(int deliveryMode)
void
setJMSDestination(javax.jms.Destination destination)
Sets the Destination object for this message.void
setJMSExpiration(long expiration)
void
setJMSMessageID(String id)
Sets the message ID.void
setJMSPriority(int priority)
void
setJMSRedelivered(boolean redelivered)
void
setJMSReplyTo(javax.jms.Destination replyTo)
void
setJMSTimestamp(long timestamp)
void
setJMSType(String type)
void
setLongProperty(String name, long value)
Sets along
property value with the specified name into the message.void
setObjectProperty(String name, Object value)
Sets a Java object property value with the specified name into the message.void
setSequenceNumber(String sequenceNumber)
This method sets the JMS_SQS_SEQUENCE_NUMBER property on the message.void
setShortProperty(String name, short value)
Sets ashort
property value with the specified name into the message.void
setSQSMessageId(String sqsMessageID)
Set SQS Message Id, used on send.void
setStringProperty(String name, String value)
Sets aString
property value with the specified name into the message.
-
-
-
Field Detail
-
BYTE_MESSAGE_TYPE
public static final String BYTE_MESSAGE_TYPE
- See Also:
- Constant Field Values
-
OBJECT_MESSAGE_TYPE
public static final String OBJECT_MESSAGE_TYPE
- See Also:
- Constant Field Values
-
TEXT_MESSAGE_TYPE
public static final String TEXT_MESSAGE_TYPE
- See Also:
- Constant Field Values
-
JMS_SQS_MESSAGE_TYPE
public static final String JMS_SQS_MESSAGE_TYPE
- See Also:
- Constant Field Values
-
JMS_SQS_REPLY_TO_QUEUE_NAME
public static final String JMS_SQS_REPLY_TO_QUEUE_NAME
- See Also:
- Constant Field Values
-
JMS_SQS_REPLY_TO_QUEUE_URL
public static final String JMS_SQS_REPLY_TO_QUEUE_URL
- See Also:
- Constant Field Values
-
JMS_SQS_CORRELATION_ID
public static final String JMS_SQS_CORRELATION_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkPropertyWritePermissions
protected void checkPropertyWritePermissions() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
checkBodyWritePermissions
protected void checkBodyWritePermissions() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
convertExceptionToJMSException
protected static javax.jms.JMSException convertExceptionToJMSException(Exception e)
-
convertExceptionToMessageFormatException
protected static javax.jms.MessageFormatException convertExceptionToMessageFormatException(Exception e)
-
setBodyWritePermissions
protected void setBodyWritePermissions(boolean enable)
-
getSQSMessageGroupId
public String getSQSMessageGroupId() throws javax.jms.JMSException
Get SQS Message Group Id (applicable for FIFO queues, available also as JMS property 'JMSXGroupId')- Throws:
javax.jms.JMSException
-
getSQSMessageDeduplicationId
public String getSQSMessageDeduplicationId() throws javax.jms.JMSException
Get SQS Message Deduplication Id (applicable for FIFO queues, available also as JMS property 'JMS_SQS_DeduplicationId')- Throws:
javax.jms.JMSException
-
getSQSMessageSequenceNumber
public String getSQSMessageSequenceNumber() throws javax.jms.JMSException
Get SQS Message Sequence Number (applicable for FIFO queues, available also as JMS property 'JMS_SQS_SequenceNumber')- Throws:
javax.jms.JMSException
-
getSQSMessageId
public String getSQSMessageId()
Get SQS Message Id.- Returns:
- SQS Message Id.
-
setSQSMessageId
public void setSQSMessageId(String sqsMessageID) throws javax.jms.JMSException
Set SQS Message Id, used on send.- Parameters:
sqsMessageID
- messageId assigned by SQS during send.- Throws:
javax.jms.JMSException
-
getReceiptHandle
public String getReceiptHandle()
Get SQS Message receiptHandle.- Returns:
- SQS Message receiptHandle.
-
getQueueUrl
public String getQueueUrl()
Get queueUrl the message came from.- Returns:
- queueUrl.
-
getJMSMessageID
public String getJMSMessageID() throws javax.jms.JMSException
Gets the message ID.The JMSMessageID header field contains a value that uniquely identifies each message sent by a provider. It is set to SQS messageId with the prefix 'ID:'.
- Specified by:
getJMSMessageID
in interfacejavax.jms.Message
- Returns:
- the ID of the message.
- Throws:
javax.jms.JMSException
-
setJMSMessageID
public void setJMSMessageID(String id) throws javax.jms.JMSException
Sets the message ID. It should have prefix 'ID:'.Set when a message is sent. This method can be used to change the value for a message that has been received.
- Specified by:
setJMSMessageID
in interfacejavax.jms.Message
- Parameters:
id
- The ID of the message.- Throws:
javax.jms.JMSException
-
getJMSTimestamp
public long getJMSTimestamp() throws javax.jms.JMSException
- Specified by:
getJMSTimestamp
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSTimestamp
public void setJMSTimestamp(long timestamp) throws javax.jms.JMSException
- Specified by:
setJMSTimestamp
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSCorrelationIDAsBytes
public byte[] getJMSCorrelationIDAsBytes() throws javax.jms.JMSException
- Specified by:
getJMSCorrelationIDAsBytes
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSCorrelationIDAsBytes
public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws javax.jms.JMSException
- Specified by:
setJMSCorrelationIDAsBytes
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSCorrelationID
public void setJMSCorrelationID(String correlationID) throws javax.jms.JMSException
- Specified by:
setJMSCorrelationID
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSCorrelationID
public String getJMSCorrelationID() throws javax.jms.JMSException
- Specified by:
getJMSCorrelationID
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSReplyTo
public javax.jms.Destination getJMSReplyTo() throws javax.jms.JMSException
- Specified by:
getJMSReplyTo
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSReplyTo
public void setJMSReplyTo(javax.jms.Destination replyTo) throws javax.jms.JMSException
- Specified by:
setJMSReplyTo
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSDestination
public javax.jms.Destination getJMSDestination() throws javax.jms.JMSException
Gets the Destination object for this message.The JMSDestination header field contains the destination to which the message is being sent.
When a message is sent, this field is ignored. After completion of the send or publish method, the field holds the destination specified by the method.
When a message is received, its JMSDestination value must be equivalent to the value assigned when it was sent.
- Specified by:
getJMSDestination
in interfacejavax.jms.Message
- Returns:
- The destination of this message.
- Throws:
javax.jms.JMSException
-
setJMSDestination
public void setJMSDestination(javax.jms.Destination destination) throws javax.jms.JMSException
Sets the Destination object for this message.Set when a message is sent. This method can be used to change the value for a message that has been received.
- Specified by:
setJMSDestination
in interfacejavax.jms.Message
- Parameters:
destination
- The destination for this message.- Throws:
javax.jms.JMSException
-
getJMSDeliveryMode
public int getJMSDeliveryMode() throws javax.jms.JMSException
- Specified by:
getJMSDeliveryMode
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSDeliveryMode
public void setJMSDeliveryMode(int deliveryMode) throws javax.jms.JMSException
- Specified by:
setJMSDeliveryMode
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSRedelivered
public boolean getJMSRedelivered() throws javax.jms.JMSException
- Specified by:
getJMSRedelivered
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSRedelivered
public void setJMSRedelivered(boolean redelivered) throws javax.jms.JMSException
- Specified by:
setJMSRedelivered
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSType
public String getJMSType() throws javax.jms.JMSException
- Specified by:
getJMSType
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSType
public void setJMSType(String type) throws javax.jms.JMSException
- Specified by:
setJMSType
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSExpiration
public long getJMSExpiration() throws javax.jms.JMSException
- Specified by:
getJMSExpiration
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSExpiration
public void setJMSExpiration(long expiration) throws javax.jms.JMSException
- Specified by:
setJMSExpiration
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSPriority
public int getJMSPriority() throws javax.jms.JMSException
- Specified by:
getJMSPriority
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSPriority
public void setJMSPriority(int priority) throws javax.jms.JMSException
- Specified by:
setJMSPriority
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
clearProperties
public void clearProperties() throws javax.jms.JMSException
Clears a message's properties and set the write permissions for properties. The message's header fields and body are not cleared.- Specified by:
clearProperties
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
propertyExists
public boolean propertyExists(String name) throws javax.jms.JMSException
Indicates whether a property value exists for the given property name.- Specified by:
propertyExists
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property.- Returns:
- true if the property exists.
- Throws:
javax.jms.JMSException
-
getBooleanProperty
public boolean getBooleanProperty(String name) throws javax.jms.JMSException
Returns the value of theboolean
property with the specified name.- Specified by:
getBooleanProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
boolean
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name is null.
-
getByteProperty
public byte getByteProperty(String name) throws javax.jms.JMSException
Returns the value of thebyte
property with the specified name.- Specified by:
getByteProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
byte
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name is null.NumberFormatException
- When property value is null.
-
getShortProperty
public short getShortProperty(String name) throws javax.jms.JMSException
Returns the value of theshort
property with the specified name.- Specified by:
getShortProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
short
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name is null.NumberFormatException
- When property value is null.
-
getIntProperty
public int getIntProperty(String name) throws javax.jms.JMSException
Returns the value of theint
property with the specified name.- Specified by:
getIntProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
int
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name is null.NumberFormatException
- When property value is null.
-
getLongProperty
public long getLongProperty(String name) throws javax.jms.JMSException
Returns the value of thelong
property with the specified name.- Specified by:
getLongProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
long
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name is null.NumberFormatException
- When property value is null.
-
getFloatProperty
public float getFloatProperty(String name) throws javax.jms.JMSException
Returns the value of thefloat
property with the specified name.- Specified by:
getFloatProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
float
property value for the specified name. - Throws:
javax.jms.JMSException
- Wn internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name or value is null.
-
getDoubleProperty
public double getDoubleProperty(String name) throws javax.jms.JMSException
Returns the value of thedouble
property with the specified name.- Specified by:
getDoubleProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
double
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name or value is null.
-
getStringProperty
public String getStringProperty(String name) throws javax.jms.JMSException
Returns the value of theString
property with the specified name.- Specified by:
getStringProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the
String
property value for the specified name. - Throws:
javax.jms.JMSException
- On internal error.javax.jms.MessageFormatException
- If the property cannot be converted to the specified type.NullPointerException
- When property name is null.
-
getObjectProperty
public Object getObjectProperty(String name) throws javax.jms.JMSException
Returns the value of the Java object property with the specified name.This method can be used to return, in boxed format, an object that has been stored as a property in the message with the equivalent
setObjectProperty
method call, or its equivalent primitive setter method.- Specified by:
getObjectProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to get.- Returns:
- the Java object property value with the specified name, in boxed
format (for example, if the property was set as an
int
, anInteger
is returned); if there is no property by this name, a null value is returned. - Throws:
javax.jms.JMSException
- On internal error.
-
getJMSMessagePropertyValue
public SQSMessage.JMSMessagePropertyValue getJMSMessagePropertyValue(String name) throws javax.jms.JMSException
Returns the property value with message attribute to object property conversions took place.- Parameters:
name
- The name of the property to get.- Returns:
JMSMessagePropertyValue
with object value and corresponding SQS message attribute type and message attribute string value.- Throws:
javax.jms.JMSException
- On internal error.
-
getPropertyNames
public Enumeration<String> getPropertyNames() throws javax.jms.JMSException
Returns anEnumeration
of all the property names.Note that JMS standard header fields are not considered properties and are not returned in this enumeration.
- Specified by:
getPropertyNames
in interfacejavax.jms.Message
- Returns:
- an enumeration of all the names of property values.
- Throws:
javax.jms.JMSException
- On internal error.
-
setBooleanProperty
public void setBooleanProperty(String name, boolean value) throws javax.jms.JMSException
Sets aboolean
property value with the specified name into the message.- Specified by:
setBooleanProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Theboolean
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setByteProperty
public void setByteProperty(String name, byte value) throws javax.jms.JMSException
Sets abyte
property value with the specified name into the message.- Specified by:
setByteProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Thebyte
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setShortProperty
public void setShortProperty(String name, short value) throws javax.jms.JMSException
Sets ashort
property value with the specified name into the message.- Specified by:
setShortProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Theshort
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setIntProperty
public void setIntProperty(String name, int value) throws javax.jms.JMSException
Sets aint
property value with the specified name into the message.- Specified by:
setIntProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Theint
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setLongProperty
public void setLongProperty(String name, long value) throws javax.jms.JMSException
Sets along
property value with the specified name into the message.- Specified by:
setLongProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Thelong
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setFloatProperty
public void setFloatProperty(String name, float value) throws javax.jms.JMSException
Sets afloat
property value with the specified name into the message.- Specified by:
setFloatProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Thefloat
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setDoubleProperty
public void setDoubleProperty(String name, double value) throws javax.jms.JMSException
Sets adouble
property value with the specified name into the message.- Specified by:
setDoubleProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- Thedouble
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setStringProperty
public void setStringProperty(String name, String value) throws javax.jms.JMSException
Sets aString
property value with the specified name into the message.- Specified by:
setStringProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- TheString
value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
setObjectProperty
public void setObjectProperty(String name, Object value) throws javax.jms.JMSException
Sets a Java object property value with the specified name into the message.Note that this method works only for the boxed primitive object types (Integer, Double, Long ...) and String objects.
- Specified by:
setObjectProperty
in interfacejavax.jms.Message
- Parameters:
name
- The name of the property to set.value
- The object value of the property to set.- Throws:
javax.jms.JMSException
- On internal error.IllegalArgumentException
- If the name or value is null or empty string.javax.jms.MessageFormatException
- If the object is invalid type.javax.jms.MessageNotWriteableException
- If properties are read-only.
-
acknowledge
public void acknowledge() throws javax.jms.JMSException
Acknowledges message(s).
A client may individually acknowledge each message as it is consumed, or it may choose to acknowledge multiple messages based on acknowledge mode, which in turn might might acknowledge all messages consumed by the session.
Messages that have been received but not acknowledged may be redelivered.
If the session is closed, messages cannot be acknowledged.
If only the consumer is closed, messages can still be acknowledged.
- Specified by:
acknowledge
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
- On Internal errorIllegalStateException
- If this method is called on a closed session.- See Also:
AcknowledgeMode
-
clearBody
public void clearBody() throws javax.jms.JMSException
Clears out the message body. Clearing a message's body does not clear its header values or property entries.
This method cannot be called directly instead the implementation on the subclasses should be used.
- Specified by:
clearBody
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
- If directly called
-
setSequenceNumber
public void setSequenceNumber(String sequenceNumber) throws javax.jms.JMSException
This method sets the JMS_SQS_SEQUENCE_NUMBER property on the message. It is exposed explicitly here, so that it can be invoked even on read-only message object obtained through receing a message. This support the use case of send a received message by using the same JMSMessage object.- Parameters:
sequenceNumber
- Sequence number to set. If null or empty, the stored sequence number will be removed.- Throws:
javax.jms.JMSException
-
-