Package org.apache.activemq.command
Class ActiveMQObjectMessage
java.lang.Object
org.apache.activemq.command.BaseCommand
org.apache.activemq.command.Message
org.apache.activemq.command.ActiveMQMessage
org.apache.activemq.command.ActiveMQObjectMessage
- All Implemented Interfaces:
jakarta.jms.Message
,jakarta.jms.ObjectMessage
,MessageReference
,Command
,DataStructure
,MarshallAware
,TransientInitializer
,Message
,ScheduledMessage
public class ActiveMQObjectMessage
extends ActiveMQMessage
implements jakarta.jms.ObjectMessage, TransientInitializer
An
ObjectMessage
object is used to send a message that
contains a serializable object in the Java programming language ("Java
object"). It inherits from the Message
interface and adds a
body containing a single reference to an object. Only
Serializable
Java objects can be used.
If a collection of Java objects must be sent, one of the
Collection
classes provided since JDK 1.2 can be used.
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.
- See Also:
-
Session.createObjectMessage()
Session.createObjectMessage(Serializable)
BytesMessage
MapMessage
Message
StreamMessage
TextMessage
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.activemq.command.Message
Message.MessageDestination
-
Field Summary
Fields inherited from class org.apache.activemq.command.ActiveMQMessage
acknowledgeCallback, BROKER_PATH_PROPERTY, DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY
Fields inherited from class org.apache.activemq.command.Message
arrival, brokerInTime, brokerOutTime, compressed, content, correlationId, dataStructure, DEFAULT_MINIMUM_MESSAGE_SIZE, deliveryTime, destination, droppable, expiration, groupID, groupSequence, jmsXGroupFirstForConsumer, marshalledProperties, messageId, ORIGINAL_EXPIRATION, originalDestination, originalTransactionId, persistent, priority, producerId, properties, readOnlyBody, readOnlyProperties, recievedByDFBridge, redeliveryCounter, replyTo, size, targetConsumerId, timestamp, transactionId, type, userID
Fields inherited from class org.apache.activemq.command.BaseCommand
commandId, responseRequired
Fields inherited from interface jakarta.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
Fields inherited from interface org.apache.activemq.ScheduledMessage
AMQ_SCHEDULED_CRON, AMQ_SCHEDULED_DELAY, AMQ_SCHEDULED_ID, AMQ_SCHEDULED_PERIOD, AMQ_SCHEDULED_REPEAT, AMQ_SCHEDULER_ACTION, AMQ_SCHEDULER_ACTION_BROWSE, AMQ_SCHEDULER_ACTION_END_TIME, AMQ_SCHEDULER_ACTION_REMOVE, AMQ_SCHEDULER_ACTION_REMOVEALL, AMQ_SCHEDULER_ACTION_START_TIME, AMQ_SCHEDULER_MANAGEMENT_DESTINATION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeMarshall
(WireFormat wireFormat) void
Clears out the message body.void
void
compress()
copy()
protected <T> T
byte
Returns the MIME type of this mesage.Gets the serializable object containing this message's data.void
boolean
boolean
boolean
void
void
setObject
(Serializable newObject) Sets the serializable object containing this message's data.void
setTrustAllPackages
(boolean trustAllPackages) void
setTrustedPackages
(List<String> trustedPackages) void
void
toString()
Methods inherited from class org.apache.activemq.command.ActiveMQMessage
acknowledge, checkReadOnlyBody, checkReadOnlyProperties, checkValidObject, clearProperties, convertScheduled, copy, decodeString, encodeString, equals, getAcknowledgeCallback, getAllPropertyNames, getBody, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, hashCode, onSend, propertyExists, setAcknowledgeCallback, setBooleanProperty, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setObjectProperty, setProperties, setShortProperty, setStringProperty, visit
Methods inherited from class org.apache.activemq.command.Message
afterMarshall, afterUnmarshall, beforeUnmarshall, canProcessAsExpired, copy, decrementReferenceCount, doCompress, getArrival, getBrokerInTime, getBrokerOutTime, getBrokerPath, getCluster, getConnection, getContent, getCorrelationId, getDataStructure, getDestination, getExpiration, getGroupID, getGroupSequence, getMarshalledProperties, getMemoryUsage, getMessage, getMessageHardRef, getMessageId, getMinimumMessageSize, getOriginalDestination, getOriginalTransactionId, getPriority, getProducerId, getProperties, getProperty, getRedeliveryCounter, getReferenceCount, getRegionDestination, getReplyTo, getSize, getTargetConsumerId, getTimestamp, getTransactionId, getType, getUserID, incrementRedeliveryCounter, incrementReferenceCount, isAdvisory, isCompressed, isDroppable, isDropped, isExpired, isInTransaction, isJMSXGroupFirstForConsumer, isMarshallAware, isMarshalled, isMessage, isPersistent, isPropertiesMarshalled, isReadOnlyBody, isReadOnlyProperties, isRecievedByDFBridge, isRedelivered, lazyCreateProperties, readResolve, removeProperty, setArrival, setBrokerInTime, setBrokerOutTime, setBrokerPath, setCluster, setCompressed, setConnection, setContent, setCorrelationId, setDataStructure, setDestination, setDroppable, setExpiration, setGroupID, setGroupSequence, setJMSXGroupFirstForConsumer, setMarshalledProperties, setMemoryUsage, setMessageId, setOriginalDestination, setOriginalTransactionId, setPersistent, setPriority, setProducerId, setProperty, setReadOnlyBody, setReadOnlyProperties, setRecievedByDFBridge, setRedelivered, setRedeliveryCounter, setRegionDestination, setReplyTo, setTargetConsumerId, setTimestamp, setTransactionId, setType, setUserID, toString
Methods inherited from class org.apache.activemq.command.BaseCommand
copy, getCommandId, getFrom, getTo, isBrokerInfo, isConnectionControl, isConsumerControl, isMessageAck, isMessageDispatch, isMessageDispatchNotification, isResponse, isResponseRequired, isShutdownInfo, isWireFormatInfo, setCommandId, setFrom, setResponseRequired, setTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface jakarta.jms.Message
acknowledge, 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
-
Field Details
-
DATA_STRUCTURE_TYPE
public static final byte DATA_STRUCTURE_TYPE- See Also:
-
object
-
-
Constructor Details
-
ActiveMQObjectMessage
public ActiveMQObjectMessage()
-
-
Method Details
-
copy
- Overrides:
copy
in classActiveMQMessage
-
storeContentAndClear
public void storeContentAndClear()- Overrides:
storeContentAndClear
in classActiveMQMessage
-
storeContent
public void storeContent()- Overrides:
storeContent
in classActiveMQMessage
-
isContentMarshalled
public boolean isContentMarshalled()- Overrides:
isContentMarshalled
in classActiveMQMessage
-
getDataStructureType
public byte getDataStructureType()- Specified by:
getDataStructureType
in interfaceDataStructure
- Overrides:
getDataStructureType
in classActiveMQMessage
- Returns:
- The type of the data structure
-
getJMSXMimeType
Description copied from interface:Message
Returns the MIME type of this mesage. This can be used in selectors to filter on the MIME types of the different JMS messages, or in the case ofBlobMessage
it allows you to create a selector on the MIME type of the BLOB body- Specified by:
getJMSXMimeType
in interfaceMessage
- Overrides:
getJMSXMimeType
in classActiveMQMessage
-
clearBody
public void clearBody() throws jakarta.jms.JMSExceptionClears out the message body. Clearing a message's body does not clear its header values or property entries.If this message body was read-only, calling this method leaves the message body in the same state as an empty body in a newly created message.
- Specified by:
clearBody
in interfacejakarta.jms.Message
- Overrides:
clearBody
in classActiveMQMessage
- Throws:
jakarta.jms.JMSException
- if the JMS provider fails to clear the message body due to some internal error.
-
setObject
Sets the serializable object containing this message's data. It is important to note that anObjectMessage
contains a snapshot of the object at the timesetObject()
is called; subsequent modifications of the object will have no effect on theObjectMessage
body.- Specified by:
setObject
in interfacejakarta.jms.ObjectMessage
- Parameters:
newObject
- the message's data- Throws:
jakarta.jms.JMSException
- if the JMS provider fails to set the object due to some internal error.jakarta.jms.MessageFormatException
- if object serialization fails.jakarta.jms.MessageNotWriteableException
- if the message is in read-only mode.
-
getObject
Gets the serializable object containing this message's data. The default value is null.- Specified by:
getObject
in interfacejakarta.jms.ObjectMessage
- Returns:
- the serializable object containing this message's data
- Throws:
jakarta.jms.JMSException
-
beforeMarshall
- Specified by:
beforeMarshall
in interfaceMarshallAware
- Overrides:
beforeMarshall
in classMessage
- Throws:
IOException
-
clearUnMarshalledState
public void clearUnMarshalledState() throws jakarta.jms.JMSException- Overrides:
clearUnMarshalledState
in classMessage
- Throws:
jakarta.jms.JMSException
-
onMessageRolledBack
public void onMessageRolledBack()- Overrides:
onMessageRolledBack
in classMessage
-
compress
- Overrides:
compress
in classMessage
- Throws:
IOException
-
toString
-
getTrustedPackages
-
setTrustedPackages
-
isTrustAllPackages
public boolean isTrustAllPackages() -
setTrustAllPackages
public void setTrustAllPackages(boolean trustAllPackages) -
initTransients
public void initTransients()- Specified by:
initTransients
in interfaceTransientInitializer
-
isBodyAssignableTo
- Specified by:
isBodyAssignableTo
in interfacejakarta.jms.Message
- Overrides:
isBodyAssignableTo
in classActiveMQMessage
- Throws:
jakarta.jms.JMSException
-
doGetBody
- Overrides:
doGetBody
in classActiveMQMessage
- Throws:
jakarta.jms.JMSException
-