Class ActiveMQObjectMessage
java.lang.Object
org.apache.activemq.artemis.jms.client.ActiveMQMessage
org.apache.activemq.artemis.jms.client.ActiveMQObjectMessage
- All Implemented Interfaces:
Message,ObjectMessage
- Direct Known Subclasses:
ActiveMQObjectCompatibleMessage
ActiveMQ Artemis implementation of a JMS ObjectMessage.
Don't used ObjectMessage if you want good performance!
Serialization is slooooow!
-
Field Summary
FieldsFields inherited from class org.apache.activemq.artemis.jms.client.ActiveMQMessage
message, OLD_QUEUE_QUALIFIED_PREFIX, OLD_TEMP_QUEUE_QUALIFED_PREFIX, OLD_TEMP_TOPIC_QUALIFED_PREFIX, OLD_TOPIC_QUALIFIED_PREFIX, propertiesReadOnly, readOnly, replyToFields inherited from interface jakarta.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE -
Constructor Summary
ConstructorsModifierConstructorDescriptionActiveMQObjectMessage(ObjectMessage foreign, ClientSession session, ConnectionFactoryOptions options) A copy constructor for foreign JMS ObjectMessages.protectedActiveMQObjectMessage(ClientMessage message, ClientSession session, ConnectionFactoryOptions options) protectedActiveMQObjectMessage(ClientSession session, ConnectionFactoryOptions options) -
Method Summary
Modifier and TypeMethodDescriptionvoidClears out the message body.voidvoidprotected <T> TgetBodyInternal(Class<T> c) Gets the serializable object containing this message's data.bytegetType()booleanFrom the specs:voidsetObject(Serializable object) Sets the serializable object containing this message's data.Methods inherited from class org.apache.activemq.artemis.jms.client.ActiveMQMessage
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, waitCompletionOnStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
-
TYPE
public static final byte TYPE- See Also:
-
-
Constructor Details
-
ActiveMQObjectMessage
-
ActiveMQObjectMessage
protected ActiveMQObjectMessage(ClientMessage message, ClientSession session, ConnectionFactoryOptions options) -
ActiveMQObjectMessage
public ActiveMQObjectMessage(ObjectMessage foreign, ClientSession session, ConnectionFactoryOptions options) throws JMSException A copy constructor for foreign JMS ObjectMessages.- Throws:
JMSException
-
-
Method Details
-
getType
public byte getType()- Overrides:
getTypein classActiveMQMessage
-
doBeforeSend
- Overrides:
doBeforeSendin classActiveMQMessage- Throws:
Exception
-
doBeforeReceive
- Overrides:
doBeforeReceivein classActiveMQMessage- Throws:
ActiveMQException
-
setObject
Description copied from interface:ObjectMessageSets the serializable object containing this message's data. It is important to note that anObjectMessagecontains a snapshot of the object at the timesetObject()is called; subsequent modifications of the object will have no effect on theObjectMessagebody.- Specified by:
setObjectin interfaceObjectMessage- Parameters:
object- the message's data- Throws:
JMSException- 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.
-
getObject
Description copied from interface:ObjectMessageGets the serializable object containing this message's data. The default value is null.- Specified by:
getObjectin interfaceObjectMessage- Returns:
- the serializable object containing this message's data
- Throws:
JMSException- if the Jakarta Messaging provider fails to get the object due to some internal error.MessageFormatException- if object deserialization fails.
-
clearBody
Description copied from interface:MessageClears 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:
clearBodyin interfaceMessage- Overrides:
clearBodyin classActiveMQMessage- Throws:
JMSException- if the Jakarta Messaging provider fails to clear the message body due to some internal error.
-
getBodyInternal
- Overrides:
getBodyInternalin classActiveMQMessage- Throws:
MessageFormatException
-
isBodyAssignableTo
Description copied from class:ActiveMQMessageFrom the specs:If the message is a
Message(but not one of its subtypes) then this method will returntrueirrespective of the value of this parameter.- Specified by:
isBodyAssignableToin interfaceMessage- Overrides:
isBodyAssignableToin classActiveMQMessage- Parameters:
c- The specified type
If the message is aTextMessagethen this method will only return true if this parameter is set toString.classor another type to which aStringis assignable.
If the message is aObjectMessagethen this method will only return true if this parameter is set tojava.io.Serializable.classor another class to which the body is assignable.
If the message is aMapMessagethen this method will only return true if this parameter is set tojava.util.Map.class(orjava.lang.Object.class).
If the message is aBytesMessagethen this this method will only return true if this parameter is set tobyte[].class(orjava.lang.Object.class).
If the message is aTextMessage,ObjectMessage,MapMessageorBytesMessageand the message has no body, then the above does not apply and this method will return true irrespective of the value of this parameter.
If the message is aMessage(but not one of its subtypes) then this method will return true irrespective of the value of this parameter.- Returns:
- whether the message body is capable of being assigned to the specified type
-