public final class ObjectMessage extends Message implements ObjectMessage
javax.jms.ObjectMessage
interface.
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.
jmsDest, logger, momMsg, propertiesRO, RObody, session
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
Constructor and Description |
---|
ObjectMessage()
Instantiates a bright new
ObjectMessage . |
ObjectMessage(Session session,
Message momMsg)
Instantiates an
ObjectMessage wrapping a
consumed MOM message containing an object. |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
getEffectiveBody(Class<T> c)
Get message body
|
Serializable |
getObject()
API method.
|
void |
setObject(Serializable object)
API method.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
acknowledge, clearBody, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
public void setObject(Serializable object) throws JMSException
setObject
in interface ObjectMessage
object
- the message's data.MessageNotWriteableException
- When trying to set an object if
the message body is read-only.MessageFormatException
- If object serialization fails.JMSException
public Serializable getObject() throws MessageFormatException
getObject
in interface ObjectMessage
MessageFormatException
- In case of a problem when getting the
body.protected <T> T getEffectiveBody(Class<T> c) throws JMSException
Message
getEffectiveBody
in class Message
c
- The type to which the message body will be assigned.JMSException
- if the JMS provider fails to return a value due to some internal error.Copyright © 2022 ScalAgent D.T.. All rights reserved.