ObjectMessage


public interface ObjectMessage
extends Message

WebSphere MQ class: JMSObjectMessage



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

An ObjectMessage is used 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.



© IBM Corporation 1997, 2002. All Rights Reserved