- java.lang.Object
-
- com.rabbitmq.jms.client.RMQMessage
-
- com.rabbitmq.jms.client.message.RMQObjectMessage
-
- All Implemented Interfaces:
jakarta.jms.Message,jakarta.jms.ObjectMessage,java.lang.Cloneable
public class RMQObjectMessage extends RMQMessage implements jakarta.jms.ObjectMessage
ImplementsObjectMessageinterface.
-
-
Field Summary
-
Fields inherited from class com.rabbitmq.jms.client.RMQMessage
DEFAULT_MESSAGE_BODY_SIZE, logger, MSG_EOF, NOT_READABLE, NOT_WRITEABLE, UNABLE_TO_CAST
-
-
Constructor Summary
Constructors Constructor Description RMQObjectMessage()RMQObjectMessage(java.util.List<java.lang.String> trustedPackages)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearBodyInternal()protected <T> TdoGetBody(java.lang.Class<T> c)java.io.SerializablegetObject()java.io.SerializablegetObject(java.util.List<java.lang.String> trustedPackages)booleanisAmqpWritable()booleanisBodyAssignableTo(java.lang.Class c)protected voidreadAmqpBody(byte[] barr)Invoked when an AMQP message is being transformed into a RMQMessage The implementing class should only read its body by this methodprotected voidreadBody(java.io.ObjectInput inputStream, java.io.ByteArrayInputStream bin)Invoked when a message is being deserialized to read and decode the message body.static RMQMessagerecreate(RMQObjectMessage msg, java.util.List<java.lang.String> patterns)static RMQMessagerecreate(jakarta.jms.ObjectMessage msg)voidsetObject(java.io.Serializable object)protected voidwriteAmqpBody(java.io.ByteArrayOutputStream out)Invoked whenRMQMessage.toAmqpByteArray()is called to create a byte[] from a message.protected voidwriteBody(java.io.ObjectOutput out, java.io.ByteArrayOutputStream bout)Invoked whenRMQMessage.toByteArray()is called to create a byte[] from a message.-
Methods inherited from class com.rabbitmq.jms.client.RMQMessage
acknowledge, clearBody, clearProperties, clone, copyAttributes, doNotDeclareReplyToDestination, equals, getBody, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getInternalID, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getRabbitDeliveryTag, getSession, getShortProperty, getStringProperty, hashCode, isReadonlyBody, isReadOnlyProperties, loggerDebugByteArray, propertyExists, readPrimitive, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setRabbitDeliveryTag, setReadonly, setReadOnlyBody, setReadOnlyProperties, setSession, setShortProperty, setStringProperty, writePrimitive, writePrimitive
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.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, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
-
-
-
-
Method Detail
-
setObject
public void setObject(java.io.Serializable object) throws jakarta.jms.JMSException- Specified by:
setObjectin interfacejakarta.jms.ObjectMessage- Throws:
jakarta.jms.JMSException
-
getObject
public java.io.Serializable getObject() throws jakarta.jms.JMSException- Specified by:
getObjectin interfacejakarta.jms.ObjectMessage- Throws:
jakarta.jms.JMSException
-
getObject
public java.io.Serializable getObject(java.util.List<java.lang.String> trustedPackages) throws jakarta.jms.JMSException- Throws:
jakarta.jms.JMSException
-
clearBodyInternal
public void clearBodyInternal() throws jakarta.jms.JMSException- Specified by:
clearBodyInternalin classRMQMessage- Throws:
jakarta.jms.JMSException
-
writeBody
protected void writeBody(java.io.ObjectOutput out, java.io.ByteArrayOutputStream bout) throws java.io.IOExceptionDescription copied from class:RMQMessageInvoked whenRMQMessage.toByteArray()is called to create a byte[] from a message. Each subclass must implement this, but ONLY write its specific body. All the properties defined inMessagewill be written by the parent class.- Specified by:
writeBodyin classRMQMessage- Parameters:
out- - the output stream to which the structured part of message body (scalar types) is writtenbout- - the output stream to which the un-structured part of message body (explicit bytes) is written- Throws:
java.io.IOException- if the body can not be written
-
readBody
protected void readBody(java.io.ObjectInput inputStream, java.io.ByteArrayInputStream bin) throws java.io.IOException, java.lang.ClassNotFoundExceptionDescription copied from class:RMQMessageInvoked when a message is being deserialized to read and decode the message body. The implementing class should only read its body from this stream. If any exception is thrown, the message will not have been delivered.- Specified by:
readBodyin classRMQMessage- Parameters:
inputStream- - the stream to read its body frombin- - the underlying byte input stream- Throws:
java.io.IOException- if a read error occurs on the input streamjava.lang.ClassNotFoundException- if the object class cannot be found
-
readAmqpBody
protected void readAmqpBody(byte[] barr)
Description copied from class:RMQMessageInvoked when an AMQP message is being transformed into a RMQMessage The implementing class should only read its body by this method- Specified by:
readAmqpBodyin classRMQMessage- Parameters:
barr- - the byte array payload of the AMQP message
-
writeAmqpBody
protected void writeAmqpBody(java.io.ByteArrayOutputStream out) throws java.io.IOExceptionDescription copied from class:RMQMessageInvoked whenRMQMessage.toAmqpByteArray()is called to create a byte[] from a message. Each subclass must implement this, but ONLY write its specific body.- Specified by:
writeAmqpBodyin classRMQMessage- Parameters:
out- - the output stream to which the message body is written- Throws:
java.io.IOException- if the body can not be written
-
recreate
public static RMQMessage recreate(jakarta.jms.ObjectMessage msg) throws jakarta.jms.JMSException
- Throws:
jakarta.jms.JMSException
-
recreate
public static RMQMessage recreate(RMQObjectMessage msg, java.util.List<java.lang.String> patterns) throws jakarta.jms.JMSException
- Throws:
jakarta.jms.JMSException
-
isBodyAssignableTo
public boolean isBodyAssignableTo(java.lang.Class c) throws jakarta.jms.JMSException- Specified by:
isBodyAssignableToin interfacejakarta.jms.Message- Throws:
jakarta.jms.JMSException
-
doGetBody
protected <T> T doGetBody(java.lang.Class<T> c) throws jakarta.jms.JMSException- Specified by:
doGetBodyin classRMQMessage- Throws:
jakarta.jms.JMSException
-
isAmqpWritable
public boolean isAmqpWritable()
- Specified by:
isAmqpWritablein classRMQMessage
-
-