Message
public interface Message
Subinterfaces: BytesMessage, MapMessage, ObjectMessage,
StreamMessage, and TextMessage
WebSphere MQ class: JMSMessage
java.lang.Object | +----com.ibm.jms.MQJMSMessageThe Message interface is the root interface of all JMS messages. It defines the JMS header and the acknowledge method used for all messages.
Fields
- DEFAULT_DELIVERY_MODE
public static final int DEFAULT_DELIVERY_MODE
The default delivery mode value.
- DEFAULT_PRIORITY
public static final int DEFAULT_PRIORITY
The default priority value.
- DEFAULT_TIME_TO_LIVE
public static final long DEFAULT_TIME_TO_LIVE
The default time-to-live value.
Methods
- acknowledge
public void acknowledge() throws JMSException
Acknowledge this and all previous messages received by the session.
- Throws:
- JMSException if JMS fails to acknowledge because of an internal JMS error.
- clearBody
public void clearBody() throws JMSException
Clear out the message body. All other parts of the message are left untouched.
- Throws:
- JMSException if JMS fails to because of an internal JMS error.
- clearProperties
public void clearProperties() throws JMSException
Clear a message's properties. The header fields and message body are not cleared.
- Throws:
- JMSException if JMS fails to clear JMS message properties because of an internal JMS error.
- getBooleanProperty
public boolean getBooleanProperty(java.lang.String name) throws JMSException
Return the boolean property value with the given name.
- Parameters:
- name: the name of the boolean property.
- Returns:
- The boolean property value with the given name.
- Throws:
- getByteProperty
public byte getByteProperty(java.lang.String name) throws JMSException
Return the byte property value with the given name.
- Parameters:
- name: the name of the byte property.
- Returns:
- The byte property value with the given name.
- Throws:
- getDoubleProperty
public double getDoubleProperty(java.lang.String name) throws JMSException
Return the double property value with the given name.
- Parameters:
- name: the name of the double property.
- Returns:
- The double property value with the given name.
- Throws:
- getFloatProperty
public float getFloatProperty(java.lang.String name) throws JMSException
Return the float property value with the given name.
- Parameters:
- name: the name of the float property.
- Returns:
- The float property value with the given name.
- Throws:
- getIntProperty
public int getIntProperty(java.lang.String name) throws JMSException
Return the integer property value with the given name.
- Parameters:
- name: the name of the integer property.
- Returns:
- The integer property value with the given name.
- Throws:
- getJMSCorrelationID
public java.lang.String getJMSCorrelationID() throws JMSException
Get the correlation ID for the message.
- Returns:
- The correlation ID of a message as a string.
- Throws:
- JMSException if JMS fails to get the correlation ID because of an internal JMS error.
- See also:
- setJMSCorrelationID(), getJMSCorrelationIDAsBytes(), setJMSCorrelationIDAsBytes()
- getJMSCorrelationIDAsBytes
public byte[] getJMSCorrelationIDAsBytes() throws JMSException
Get the correlation ID as an array of bytes for the message.
- Returns:
- The correlation ID of a message as an array of bytes.
- Throws:
- JMSException if JMS fails to get correlation ID because of an internal JMS error.
- See also:
- setJMSCorrelationID(), getJMSCorrelationID(), setJMSCorrelationIDAsBytes()
- getJMSDeliveryMode
public int getJMSDeliveryMode() throws JMSException
Get the delivery mode for this message.
- Returns:
- The delivery mode of this message.
- Throws:
- JMSException if JMS fails to get JMS DeliveryMode because of an internal JMS error.
- See also:
- setJMSDeliveryMode(), DeliveryMode
- getJMSDestination
public Destination getJMSDestination() throws JMSException
Get the destination for this message.
- Returns:
- The destination of this message.
- Throws:
- JMSException if JMS fails to get JMS Destination because of an internal JMS error.
- See also:
- setJMSDestination()
- getJMSExpiration
public long getJMSExpiration() throws JMSException
Get the message's expiration value.
- Returns:
- The time that the message expires. It is the sum of the time-to-live value specified by the client, and the GMT at the time of the send.
- Throws:
- JMSException if JMS fails to get JMS message expiration because of an internal JMS error.
- See also:
- setJMSExpiration()
- getJMSMessageID
public java.lang.String getJMSMessageID() throws JMSException
Get the message ID.
- Returns:
- The message ID.
- Throws:
- JMSException if JMS fails to get the message ID because of an internal JMS error.
- See also:
- setJMSMessageID()
- getJMSPriority
public int getJMSPriority() throws JMSException
Get the message priority.
- Returns:
- The message priority.
- Throws:
- JMSException if JMS fails to get JMS message priority because of an internal JMS error.
- See also:
- setJMSPriority() for priority levels
- getJMSRedelivered
public boolean getJMSRedelivered() throws JMSException
Get an indication of whether this message is being redelivered.
If a client receives a message with the redelivered indicator set, it is likely, but not guaranteed, that this message was delivered to the client earlier, but that the client did not acknowledge its receipt at that earlier time.
- Returns:
- Set to true if this message is being redelivered.
- Throws:
- JMSException if JMS fails to get JMS redelivered flag because of an internal JMS error.
- See also:
- setJMSRedelivered()
- getJMSReplyTo
public Destination getJMSReplyTo() throws JMSException
Get where a reply to this message should be sent.
- Returns:
- Where to send a response to this message
- Throws:
- JMSException if JMS fails to get ReplyTo destination because of an internal JMS error.
- See also:
- setJMSReplyTo()
- getJMSTimestamp
public long getJMSTimestamp() throws JMSException
Get the message timestamp.
- Returns:
- The message timestamp.
- Throws:
- JMSException if JMS fails to get the timestamp because of an internal JMS error.
- See also:
- setJMSTimestamp()
- getJMSType
public java.lang.String getJMSType() throws JMSException
Get the message type.
- Returns:
- The message type.
- Throws:
- JMSException if JMS fails to get JMS message type because of an internal JMS error.
- See also:
- setJMSType()
- getLongProperty
public long getLongProperty(java.lang.String name) throws JMSException
Return the long property value with the given name.
- Parameters:
- name: the name of the long property.
- Returns:
- The long property value with the given name.
- Throws:
- getObjectProperty
public java.lang.Object getObjectProperty (java.lang.String name) throws JMSException
Return the Java object property value with the given name.
- Parameters:
- name: the name of the Java object property.
- Returns:
- The Java object property value with the given name, in object format (for example, if it set as an int, an Integer is returned). If there is no property by this name, a null value is returned.
- Throws:
- JMSException if JMS fails to get the property because of an internal JMS error.
- getPropertyNames
public java.util.Enumeration getPropertyNames() throws JMSException
Return an enumeration of all the property names.
- Returns:
- An enumeration of all the names of property values.
- Throws:
- JMSException if JMS fails to get the property names because of an internal JMS error.
- getShortProperty
public short getShortProperty(java.lang.String name) throws JMSException
Return the short property value with the given name.
- Parameters:
- name: the name of the short property.
- Returns:
- The short property value with the given name.
- Throws:
- getStringProperty
public java.lang.String getStringProperty (java.lang.String name) throws JMSException
Return the string property value with the given name.
- Parameters:
- name: the name of the string property
- Returns:
- The string property value with the given name. If there is no property by this name, a null value is returned.
- Throws:
- propertyExists
public boolean propertyExists(java.lang.String name) throws JMSException
Check if a property value exists.
- Parameters:
- name: the name of the property to test.
- Returns:
- True if the property does exist.
- Throws:
- JMSException if JMS fails to check whether a property exists because of an internal JMS error.
- setBooleanProperty
public void setBooleanProperty(java.lang.String name, boolean value) throws JMSException
Set a boolean property value with the given name into the message.
- Parameters:
- name: the name of the boolean property.
- value: the boolean property value to set in the message.
- Throws:
- setByteProperty
public void setByteProperty(java.lang.String name, byte value) throws JMSException
Set a byte property value with the given name into the message.
- Parameters:
- name: the name of the byte property.
- value: the byte property value to set in the message.
- Throws:
- setDoubleProperty
public void setDoubleProperty(java.lang.String name, double value) throws JMSException
Set a double property value with the given name into the message.
- Parameters:
- name: the name of the double property.
- value: the double property value to set in the message.
- Throws:
- setFloatProperty
public void setFloatProperty(java.lang.String name, float value) throws JMSException
Set a float property value with the given name into the message.
- Parameters:
- name: the name of the float property.
- value: the float property value to set in the message.
- Throws:
- setIntProperty
public void setIntProperty(java.lang.String name, int value) throws JMSException
Set an integer property value with the given name into the message.
- Parameters:
- name: the name of the integer property.
- value: the integer property value to set in the message.
- Throws:
- setJMSCorrelationID
public void setJMSCorrelationID (java.lang.String correlationID) throws JMSException
Set the correlation ID for the message.
A client can use the JMSCorrelationID header field to link one message with another. A typical use is to link a response message with its request message.
- Note:
- The use of a byte[] value for JMSCorrelationID is non-portable.
- Parameters:
- correlationID: the message ID of a message being referred to.
- Throws:
- JMSException if JMS fails to set the correlation ID because of an internal JMS error.
- See also:
- getJMSCorrelationID(), getJMSCorrelationIDAsBytes(), setJMSCorrelationIDAsBytes()
- setJMSCorrelationIDAsBytes
public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException
Set the correlation ID as an array of bytes for the message. A client can use this call to set the correlationID equal either to a messageID from a previous message, or to an application-specific string. Application-specific strings must not start with the characters ID.
- Parameters:
- correlationID: the correlation ID as a string, or the message ID of a message being referred to.
- Throws:
- JMSException if JMS fails to set the correlation ID because of an internal JMS error.
- See also:
- setJMSCorrelationID(), getJMSCorrelationID(), getJMSCorrelationIDAsBytes()
- setJMSDeliveryMode
public void setJMSDeliveryMode(int deliveryMode) throws JMSException
Set the delivery mode for this message.
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
To alter the delivery mode when a message is sent, use the setDeliveryMode method on the QueueSender or TopicPublisher (this method is inherited from MessageProducer).
- Parameters:
- deliveryMode: the delivery mode for this message.
- Throws:
- JMSException if JMS fails to set JMS DeliveryMode because of an internal JMS error.
- See also:
- getJMSDeliveryMode(), DeliveryMode
- setJMSDestination
public void setJMSDestination(Destination destination) throws JMSexception
Set the destination for this message.
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
- Parameters:
- destination: the destination for this message.
- Throws:
- JMSException if JMS fails to set JMS destination because of an internal JMS error.
- See also:
- getJMSDestination()
- setJMSExpiration
public void setJMSExpiration(long expiration) throws JMSException
Set the message's expiration value.
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
- Parameters:
- expiration: the message's expiration time.
- Throws:
- JMSException if JMS fails to set JMS message expiration because of an internal JMS error.
- See also:
- getJMSExpiration()
- setJMSMessageID
public void setJMSMessageID(java.lang.String id) throws JMSException
Set the message ID.
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
- Parameters:
- id: the ID of the message.
- Throws:
- JMSException if JMS fails to set the message ID because of an internal JMS error.
- See also:
- getJMSMessageID()
- setJMSPriority
public void setJMSPriority(int priority) throws JMSException
Set the priority for this message.
JMS defines a ten-level priority value, with 0 as the lowest priority, and 9 as the highest. In addition, clients must consider priorities 0-4 as gradations of normal priority, and priorities 5-9 as gradations of expedited priority.
- Parameters:
- priority: the priority of this message.
- Throws:
- JMSException if JMS fails to set JMS message priority because of an internal JMS error.
- See also:
- getJMSPriority()
- setJMSRedelivered
public void setJMSRedelivered(boolean redelivered) throws JMSException
Set to indicate whether this message is being redelivered.
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
- Parameters:
- redelivered: an indication of whether this message is being redelivered.
- Throws:
- JMSException if JMS fails to set JMSRedelivered flag because of an internal JMS error.
- See also:
- getJMSRedelivered()
- setJMSReplyTo
public void setJMSReplyTo(Destination replyTo) throws JMSException
Set where a reply to this message should be sent.
- Parameters:
- replyTo: where to send a response to this message. A null value indicates that no reply is expected.
- Throws:
- JMSException if JMS fails to set ReplyTo destination because of an internal JMS error.
- See also:
- getJMSReplyTo()
- setJMSTimestamp
public void setJMSTimestamp(long timestamp) throws JMSException
Set the message timestamp.
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
- Parameters:
- timestamp: the timestamp for this message.
- Throws:
- JMSException if JMS fails to set the timestamp because of an internal JMS error.
- See also:
- getJMSTimestamp()
- setJMSType
public void setJMSType(java.lang.String type) throws JMSException
Set the message type.
JMS clients must assign a value to type whether the application makes use of it or not. This ensures that it is properly set for those providers that require it.
- Parameters:
- type: the class of message.
- Throws:
- JMSException if JMS fails to set JMS message type because of an internal JMS error.
- See also:
- getJMSType()
- setLongProperty
public void setLongProperty(java.lang.String name, long value) throws JMSException
Set a long property value with the given name into the message.
- Parameters:
- name: the name of the long property.
- value: the long property value to set in the message.
- Throws:
- setObjectProperty
public void setObjectProperty(java.lang.String name, java.lang.Object value) throws JMSException
Set a property value with the given name into the message.
- Parameters:
- name: the name of the Java object property.
- value: the Java object property value to set in the message.
- Throws:
- setShortProperty
public void setShortProperty(java.lang.String name, short value) throws JMSException
Set a short property value with the given name into the message.
- Parameters:
- name: the name of the short property.
- value: the short property value to set in the message.
- Throws:
- setStringProperty
public void setStringProperty(java.lang.String name, java.lang.String value) throws JMSException
Set a string property value with the given name into the message.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.