Package org.objectweb.joram.client.jms
Class ObjectMessage
- java.lang.Object
-
- org.objectweb.joram.client.jms.Message
-
- org.objectweb.joram.client.jms.ObjectMessage
-
- All Implemented Interfaces:
Message,ObjectMessage
public final class ObjectMessage extends Message implements ObjectMessage
Implements thejavax.jms.ObjectMessageinterface.An ObjectMessage object is used to send a message that contains a unique serializable Java object. It inherits from the Message interface and adds a body containing a single reference to an object.
When a client receives an ObjectMessage, it is in read-only mode. If a client attempts to write to the message at this point, a MessageNotWriteableException is thrown. If clearBody is called, the message can now be both read from and written to.
-
-
Field Summary
-
Fields inherited from class org.objectweb.joram.client.jms.Message
jmsDest, logger, momMsg, propertiesRO, RObody, session
-
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
-
-
Constructor Summary
Constructors Constructor Description ObjectMessage()Instantiates a bright newObjectMessage.ObjectMessage(Session session, org.objectweb.joram.shared.messages.Message momMsg)Instantiates anObjectMessagewrapping a consumed MOM message containing an object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> TgetEffectiveBody(Class<T> c)Get message bodySerializablegetObject()API method.voidsetObject(Serializable object)API method.-
Methods inherited from class org.objectweb.joram.client.jms.Message
acknowledge, clearBody, clearProperties, convertJMSMessage, dumpBody, dumpBody, getBody, getBooleanProperty, getByteProperty, getCompressedMinSize, getCompressionLevel, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getMomMsg, getObjectProperty, getProperties, getPropertyNames, getRawBody, getShortProperty, getStringProperty, isBodyAssignableTo, isCompressed, prepare, prepareJMSMessage, propertyExists, resetPropertiesRO, setBooleanProperty, setByteProperty, setCompressedMinSize, setCompressionLevel, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, toString, toString, wrapMomMessage
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.jms.Message
acknowledge, clearBody, clearProperties, getBody, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, isBodyAssignableTo, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
-
-
-
-
Constructor Detail
-
ObjectMessage
ObjectMessage()
Instantiates a bright newObjectMessage.
-
ObjectMessage
ObjectMessage(Session session, org.objectweb.joram.shared.messages.Message momMsg)
Instantiates anObjectMessagewrapping a consumed MOM message containing an object.- Parameters:
session- The consuming session.momMsg- The MOM message to wrap.
-
-
Method Detail
-
setObject
public void setObject(Serializable object) throws JMSException
API method. Sets the serializable object containing this message's data. It is important to note that an ObjectMessage contains a snapshot of the object at the time setObject() is called; subsequent modifications of the object will have no effect on the ObjectMessage body.- Specified by:
setObjectin interfaceObjectMessage- Parameters:
object- the message's data.- Throws:
MessageNotWriteableException- When trying to set an object if the message body is read-only.MessageFormatException- If object serialization fails.JMSException
-
getObject
public Serializable getObject() throws MessageFormatException
API method.- Specified by:
getObjectin interfaceObjectMessage- Throws:
MessageFormatException- In case of a problem when getting the body.
-
getEffectiveBody
protected <T> T getEffectiveBody(Class<T> c) throws JMSException
Description copied from class:MessageGet message body- Overrides:
getEffectiveBodyin classMessage- Parameters:
c- The type to which the message body will be assigned.- Returns:
- message body
- Throws:
JMSException- if the JMS provider fails to return a value due to some internal error.
-
-