public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMessage
Serialization is slooooow!
Modifier and Type | Field and Description |
---|---|
static byte |
TYPE |
message, OLD_QUEUE_QUALIFIED_PREFIX, OLD_TEMP_QUEUE_QUALIFED_PREFIX, OLD_TEMP_TOPIC_QUALIFED_PREFIX, OLD_TOPIC_QUALIFIED_PREFIX, propertiesReadOnly, readOnly, replyTo
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
Modifier | Constructor and Description |
---|---|
protected |
ActiveMQObjectMessage(ClientMessage message,
ClientSession session,
ConnectionFactoryOptions options) |
protected |
ActiveMQObjectMessage(ClientSession session,
ConnectionFactoryOptions options) |
|
ActiveMQObjectMessage(ObjectMessage foreign,
ClientSession session,
ConnectionFactoryOptions options)
A copy constructor for foreign JMS ObjectMessages.
|
Modifier and Type | Method and Description |
---|---|
void |
clearBody()
Clears out the message body.
|
void |
doBeforeReceive() |
void |
doBeforeSend() |
protected <T> T |
getBodyInternal(Class<T> c) |
Serializable |
getObject()
Gets the serializable object containing this message's data.
|
byte |
getType() |
boolean |
isBodyAssignableTo(Class c)
Returns whether the message body is capable of being assigned to the specified type.
|
void |
setObject(Serializable object)
Sets the serializable object containing this message's data.
|
acknowledge, checkBuffer, checkPrefix, checkPrefixStr, checkRead, checkWrite, clearProperties, coreCompositeTypeToJMSCompositeType, coreMaptoJMSMap, createMessage, createMessage, getBody, getBooleanProperty, getByteProperty, getCoreMessage, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, hasNoBody, prefixOf, propertyExists, resetMessageID, saveToOutputStream, setBooleanProperty, setByteProperty, setClientAcknowledge, setDoubleProperty, setFloatProperty, setIndividualAcknowledge, setInputStream, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setOutputStream, setShortProperty, setStringProperty, toString, waitCompletionOnStream
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
public static final byte TYPE
protected ActiveMQObjectMessage(ClientSession session, ConnectionFactoryOptions options)
protected ActiveMQObjectMessage(ClientMessage message, ClientSession session, ConnectionFactoryOptions options)
public ActiveMQObjectMessage(ObjectMessage foreign, ClientSession session, ConnectionFactoryOptions options) throws JMSException
JMSException
public byte getType()
getType
in class ActiveMQMessage
public void doBeforeSend() throws Exception
doBeforeSend
in class ActiveMQMessage
Exception
public void doBeforeReceive() throws ActiveMQException
doBeforeReceive
in class ActiveMQMessage
ActiveMQException
public void setObject(Serializable object) throws JMSException
ObjectMessage
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
object
- the message's dataJMSException
- if the Jakarta Messaging 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 Serializable getObject() throws JMSException
ObjectMessage
getObject
in interface ObjectMessage
JMSException
- if the Jakarta Messaging provider fails to get the object due to some internal error.MessageFormatException
- if object deserialization fails.public void clearBody() throws JMSException
Message
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 Jakarta Messaging provider fails to clear the message body due to some internal error.protected <T> T getBodyInternal(Class<T> c) throws MessageFormatException
getBodyInternal
in class ActiveMQMessage
MessageFormatException
public boolean isBodyAssignableTo(Class c)
Message
getBody
on the same message with the same type argument would not throw a
MessageFormatException.
If the message is a StreamMessage
then false is always returned. If the message is a ObjectMessage
and object deserialization fails then false is returned. If the message has no body then any type may be specified
and true is returned.
isBodyAssignableTo
in interface Message
isBodyAssignableTo
in class ActiveMQMessage
c
- The specified type TextMessage
then this method will only return true if this parameter is set to
String.class
or another type to which a String
is assignable. ObjectMessage
then this method will only return true if this parameter is set to
java.io.Serializable.class
or another class to which the body is assignable. MapMessage
then this method will only return true if this parameter is set to
java.util.Map.class
(or java.lang.Object.class
). BytesMessage
then this this method will only return true if this parameter is set to
byte[].class
(or java.lang.Object.class
). TextMessage
, ObjectMessage
, MapMessage
or BytesMessage
and the
message has no body, then the above does not apply and this method will return true irrespective of the value of this
parameter.Message
(but not one of its subtypes) then this method will return true irrespective of
the value of this parameter.Copyright © 2020 JBoss by Red Hat. All rights reserved.