ObjectMessage


public interface ObjectMessage
extends Message

WebSphere MQ class: JMSObjectMessage



java.lang.Object
   |
   +----com.ibm.jms.JMSMessage
           |
           +----com.ibm.jms.JMSObjectMessage

Use an ObjectMessage to send a message that contains a serializable Java object. It inherits from Message and adds a body containing a single Java reference. Only serializable Java objects can be used.

See also: BytesMessage, MapMessage, Message, StreamMessage, and TextMessage

 

Methods

getObject
public java.io.Serializable getObject()
                             throws JMSException

Get the serializable object containing this message's data. The default value is null.

Returns:
The serializable object containing this message's data.

Throws:

  • JMSException if JMS fails to get the object because of an internal JMS error.

  • MessageFormatException if object deserialization fails.

setObject
public void setObject java.io.Serializable(object)
                                      throws JMSException

Set the serializable object containing this message's data. The ObjectMessage contains a snapshot of the object at the time setObject() is called. Subsequent modifications of the object have no effect on the ObjectMessage body.

Parameters:
object: the message's data.

Throws:

  • JMSException if JMS fails to set the object because of an internal JMS error.

  • MessageFormatException if object serialization fails.

  • MessageNotWriteableException if the message is in read-only mode.

 

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.