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:
- Message, ObjectMessage, MessageReference, Command, DataStructure, MarshallAware
public class ActiveMQObjectMessage
- extends ActiveMQMessage
- implements ObjectMessage
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
Fields inherited from class org.apache.activemq.command.Message |
arrival, brokerInTime, brokerOutTime, compressed, content, correlationId, dataStructure, DEFAULT_MINIMUM_MESSAGE_SIZE, destination, droppable, expiration, groupID, groupSequence, marshalledProperties, messageId, originalDestination, originalTransactionId, persistent, priority, producerId, properties, readOnlyBody, readOnlyProperties, recievedByDFBridge, redeliveryCounter, replyTo, size, targetConsumerId, timestamp, transactionId, type, userID |
Methods inherited from class org.apache.activemq.command.ActiveMQMessage |
acknowledge, checkReadOnlyBody, checkValidObject, clearProperties, copy, decodeString, encodeString, equals, getAcknowledgeCallback, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, 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, 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, beforeMarshall, beforeUnmarshall, copy, decrementReferenceCount, 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, isMarshallAware, isMessage, isPersistent, isReadOnlyBody, isReadOnlyProperties, isRecievedByDFBridge, isRedelivered, lazyCreateProperties, setArrival, setBrokerInTime, setBrokerOutTime, setBrokerPath, setCluster, setCompressed, setConnection, setContent, setCorrelationId, setDataStructure, setDestination, setDroppable, setExpiration, setGroupID, setGroupSequence, 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, isMessageAck, isMessageDispatch, isMessageDispatchNotification, isResponse, isResponseRequired, isShutdownInfo, isWireFormatInfo, setCommandId, setFrom, setResponseRequired, setTo |
Methods inherited from interface javax.jms.Message |
acknowledge, 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 |
DATA_STRUCTURE_TYPE
public static final byte DATA_STRUCTURE_TYPE
- See Also:
- Constant Field Values
object
protected transient Serializable object
ActiveMQObjectMessage
public ActiveMQObjectMessage()
copy
public Message copy()
- Overrides:
copy
in class ActiveMQMessage
storeContent
public void storeContent()
getDataStructureType
public byte getDataStructureType()
- Specified by:
getDataStructureType
in interface DataStructure
- Overrides:
getDataStructureType
in class ActiveMQMessage
- Returns:
- The type of the data structure
getJMSXMimeType
public String 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 of
BlobMessage
it allows you to create a selector on the MIME type of the BLOB body
- Overrides:
getJMSXMimeType
in class ActiveMQMessage
clearBody
public void clearBody()
throws JMSException
- Clears 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 interface Message
- Overrides:
clearBody
in class ActiveMQMessage
- Throws:
JMSException
- if the JMS provider fails to clear the message body
due to some internal error.
setObject
public void setObject(Serializable newObject)
throws JMSException
- 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:
setObject
in interface ObjectMessage
- Parameters:
newObject
- the message's data
- Throws:
JMSException
- if the JMS provider fails to set the object due to
some internal error.
MessageFormatException
- if object serialization fails.
MessageNotWriteableException
- if the message is in
read-only mode.
getObject
public Serializable getObject()
throws JMSException
- Gets the serializable object containing this message's data. The default
value is null.
- Specified by:
getObject
in interface ObjectMessage
- Returns:
- the serializable object containing this message's data
- Throws:
JMSException
onMessageRolledBack
public void onMessageRolledBack()
- Overrides:
onMessageRolledBack
in class Message
toString
public String toString()
- Overrides:
toString
in class Message
Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.