|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activemq.message.AbstractPacket
org.activemq.message.ActiveMQMessage
org.activemq.message.ActiveMQObjectMessage
public class ActiveMQObjectMessage
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.
Session.createObjectMessage()
,
Session.createObjectMessage(Serializable)
,
BytesMessage
,
MapMessage
,
Message
,
StreamMessage
,
TextMessage
Field Summary |
---|
Fields inherited from class org.activemq.message.AbstractPacket |
---|
bitArray, BROKERS_VISITED_INDEX, cachedHashCode, RECEIPT_REQUIRED_INDEX |
Fields inherited from interface javax.jms.Message |
---|
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE |
Constructor Summary | |
---|---|
ActiveMQObjectMessage()
|
Method Summary | |
---|---|
void |
clearBody()
Clears out the message body. |
protected JMSException |
createFailedToBuildBodyException(IOException ioe)
|
ActiveMQMessage |
deepCopy()
|
Serializable |
getObject()
Gets the serializable object containing this message's data. |
int |
getPacketType()
Return the type of Packet |
void |
prepareMessageBody()
Prepare a message body for delivery |
void |
readBody(DataInput dataIn)
Used to help build the body from an input stream |
void |
setObject(Serializable newObject)
Sets the serializable object containing this message's data. |
void |
setObjectPayload(Object newObject)
|
ActiveMQMessage |
shallowCopy()
|
String |
toString()
|
void |
writeBody(DataOutput dataOut)
Used serialize the message body to an output stream |
Methods inherited from class org.activemq.message.AbstractPacket |
---|
addBrokerVisited, clearBrokersVisited, decrementMemoryReferenceCount, equals, getBitArray, getBrokersVisited, getBrokersVisitedAsString, getId, getMemoryUsage, getMemoryUsageReferenceCount, getPacketTypeAsString, hasVisited, incrementMemoryReferenceCount, initializeOther, isReceipt, isReceiptRequired, setBitArray, setBrokersVisitedAsString, setId, setMemoryUsage, setReceiptRequired |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.activemq.io.util.MemoryManageable |
---|
decrementMemoryReferenceCount, getMemoryUsage, getMemoryUsageReferenceCount, incrementMemoryReferenceCount |
Constructor Detail |
---|
public ActiveMQObjectMessage()
Method Detail |
---|
public int getPacketType()
getPacketType
in interface Packet
getPacketType
in class ActiveMQMessage
public ActiveMQMessage shallowCopy() throws JMSException
shallowCopy
in class ActiveMQMessage
JMSException
public ActiveMQMessage deepCopy() throws JMSException
deepCopy
in class ActiveMQMessage
JMSException
public void clearBody() throws JMSException
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.
clearBody
in interface Message
clearBody
in class ActiveMQMessage
JMSException
- if the JMS provider fails to clear the message
body due to some internal error.public void setObject(Serializable newObject) throws JMSException
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.
setObject
in interface ObjectMessage
newObject
- the message's data
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.public void setObjectPayload(Object newObject)
public Serializable getObject() throws JMSException
getObject
in interface ObjectMessage
JMSException
public void prepareMessageBody() throws JMSException
prepareMessageBody
in class ActiveMQMessage
JMSException
public void writeBody(DataOutput dataOut) throws IOException
writeBody
in interface BodyPacket
writeBody
in class ActiveMQMessage
dataOut
-
IOException
public void readBody(DataInput dataIn) throws IOException
readBody
in interface BodyPacket
readBody
in class ActiveMQMessage
dataIn
-
IOException
public String toString()
toString
in class ActiveMQMessage
protected JMSException createFailedToBuildBodyException(IOException ioe)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |