public final class ObjectMessage extends Message implements jakarta.jms.ObjectMessage
jakarta.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.
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, 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
public void setObject(Serializable object) throws jakarta.jms.JMSException
setObject
in interface jakarta.jms.ObjectMessage
object
- the message's data.jakarta.jms.MessageNotWriteableException
- When trying to set an object if
the message body is read-only.jakarta.jms.MessageFormatException
- If object serialization fails.jakarta.jms.JMSException
public Serializable getObject() throws jakarta.jms.MessageFormatException
getObject
in interface jakarta.jms.ObjectMessage
jakarta.jms.MessageFormatException
- In case of a problem when getting the
body.protected <T> T getEffectiveBody(Class<T> c) throws jakarta.jms.JMSException
Message
getEffectiveBody
in class Message
c
- The type to which the message body will be assigned.jakarta.jms.JMSException
- if the JMS provider fails to return a value due to some internal error.Copyright © 2023 ScalAgent D.T.. All rights reserved.