A Message object represents a message that an application sends or receives. IMessage is a superclass for the message classes such as IMapMessage.
IBM.XMS.IPropertyContext | +----IBM.XMS.IMessage
For a list of the JMS message header fields in a Message object, see Header fields in an XMS message. For a list of the JMS defined properties of a Message object, see JMS defined properties of a message. For a list of the IBM defined properties of a Message object, see IBM defined properties of a message.
Messages are deleted by the garbage collector. When a message is deleted, this frees the resources it was using.
.NET property | Description |
---|---|
JMSCorrelationID | Get and set the correlation identifier of the message as a String object. |
JMSDeliveryMode | Get and set the delivery mode of the message. |
JMSDestination | Get and set the destination of the message. |
JMSExpiration | Get and set the expiration time of the message. |
JMSMessageID | Get and set the message identifier of the message as a string object encapsulating the message identifier. |
JMSPriority | Get and set the priority of the message. |
JMSRedelivered | Get an indication of whether the message is being re-delivered, and indicate whether the message is being re-delivered. |
JMSReplyTo | Get and set the destination where a reply to the message is to be sent. |
JMSTimestamp | Get and set the time when the message was sent. |
JMSType | Get and set the type of the message. |
PropertyNames | Get an enumeration of the names properties of the message. |
DeliveryMode JMSDeliveryMode { get; set; }
Get and set the delivery mode of the message.
The delivery mode of the message is one of the following values:
For a newly created message that has not been sent, the delivery mode is DeliveryMode.Persistent, except for a real-time connection to a broker for which the delivery mode is DeliveryMode.NonPersistent. For a message that has been received, the method returns the delivery mode that was set by the IMessageProducer.send() call when the message was sent unless the receiving application changes the delivery mode by setting JMSDeliveryMode.
IDestination JMSDestination { get; set; }
Get and set the destination of the message.
The destination is set by the IMessageProducer.send() call when the message is sent. The value of JMSDestination is ignored. However, you can use JMSDestination to change the destination of a message that has been received.
For a newly created message that has not been sent, the method returns a null Destination object, unless the sending application sets a destination by setting JMSDestination. For a message that has been received, the method returns a Destination object for the destination that was set by the IMessageProducer.send() call when the message was sent unless the receiving application changes the destination by setting JMSDestination.
Int64 JMSExpiration { get; set; }
Get and set the expiration time of the message.
The expiration time is set by the IMessageProducer.send() call when the message is sent. Its value is calculated by adding the time to live, as specified by the sending application, to the time when the message is sent. The expiration time is expressed in milliseconds since 00:00:00 GMT on the 1 January 1970.
For a newly created message that has not been sent, the expiration time is 0 unless the sending application sets a different expiration time by setting JMSExpiration. For a message that has been received, the method returns the expiration time that was set by the IMessageProducer.send() call when the message was sent unless the receiving application changes the expiration time by setting JMSExpiration.
If the time to live is 0, the IMessageProducer.send() call sets the expiration time to 0 to indicate that the message does not expire.
XMS discards expired messages and does not deliver them to applications.
String JMSMessageID { get; set; }
Get and set the message identifier of the message as a string object encapsulating the message identifier.
The message identifier is set by the IMessageProducer.send() call when the message is sent. For a message that has been received, the method returns the message identifier that was set by the IMessageProducer.send() call when the message was sent unless the receiving application changes the message identifier by setting JMSMessageID.
If the message has no message identifier, the method returns a null.
Int32 JMSPriority { get; set; }
Get and set the priority of the message.
The priority is set by the IMessageProducer.send() call when the message is sent. The value is an integer in the range 0, the lowest priority, to 9, the highest priority.
For a newly created message that has not been sent, the priority is 4 unless the sending application sets a different priority by setting JMSPriority. For a message that has been received, the method returns the priority that was set by the IMessageProducer.send() call when the message was sent unless the receiving application changes the priority by setting JMSPriority.
Boolean JMSRedelivered { get; set; }
Get an indication of whether the message is being re-delivered, and indicate whether the message is being re-delivered. The indication is set by the IMessageConsumer.receive() call when the message is received.
This property has the following values:
For a real-time connection to a broker, the value is always False.
An indication of re-delivery set by JMSRedelivered before the message is sent is ignored by the IMessageProducer.send() call when the message is sent, and is ignored and replaced by the IMessageConsumer.receive() call when the message is received. However, you can useJMSRedelivered to change the indication for a message that has been received.
IDestination JMSReplyTo { get; set; }
Get and set the destination where a reply to the message is to be sent.
The value of this property is a Destination object for the destination where a reply to the message is to be sent. A null Destination object means that no reply is expected.
Int64 JMSTimestamp { get; set; }
Get and set the time when the message was sent.
The time stamp is set by the IMessageProducer.send() call when the message is sent and is expressed in milliseconds since 00:00:00 GMT on the 1 January 1970.
For a newly created message that has not been sent, the time stamp is 0 unless the sending application sets a different time stamp by setting JMSTimestamp. For a message that has been received, the method returns the time stamp that was set by the IMessageProducer.send() call when the message was sent unless the receiving application changes the time stamp by setting JMSTimestamp.
Method | Description |
---|---|
Acknowledge | Acknowledge this message and all previously unacknowledged messages received by the session. |
ClearBody | Clear the body of the message. |
ClearProperties | Clear the properties of the message. |
PropertyExists | Check whether the message has a property with the specified name. |
void Acknowledge();
Acknowledge this message and all previously unacknowledged messages received by the session.
An application can call this method if the acknowledgement mode of the session is AcknowledgeMode.ClientAcknowledge. Calls to the method are ignored if the session has any other acknowledgement mode or is transacted.
Messages that have been received but not acknowledged might be re-delivered.
For more information about acknowledging messages, see Acknowledging the receipt of messages in a session.
void ClearBody();
Clear the body of the message. The header fields and message properties are not cleared.
If an application clears a message body, the body is left in the same state as an empty body in a newly created message. The state of an empty body in a newly created message depends on the type of message body. For more information, see The body of an XMS message.
An application can clear a message body at any time, no matter what state the body is in. If a message body is read-only, the only way that an application can write to the body is for the application to clear the body first.
void ClearProperties();
Clear the properties of the message. The header fields and the message body are not cleared.
If an application clears the properties of a message, the properties become readable and writable.
An application can clear the properties of a message at any time, no matter what state the properties are in. If the properties of a message are read-only, the only way that the properties can become writable is for the application to clear the properties first.
Boolean PropertyExists(String propertyName);
Check whether the message has a property with the specified name.