Class ActiveMQTextMessage
- java.lang.Object
-
- org.apache.activemq.artemis.jms.client.ActiveMQMessage
-
- org.apache.activemq.artemis.jms.client.ActiveMQTextMessage
-
- All Implemented Interfaces:
Message,TextMessage
- Direct Known Subclasses:
ActiveMQTextCompatibleMessage
public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
ActiveMQ Artemis implementation of a JMS TextMessage.
This class was ported from SpyTextMessage in JBossMQ.
-
-
Field Summary
Fields Modifier and Type Field Description static byteTYPE-
Fields 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, replyTo
-
Fields inherited from interface jakarta.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
-
-
Constructor Summary
Constructors Constructor Description ActiveMQTextMessage(TextMessage foreign, ClientSession session)A copy constructor for non-ActiveMQ Artemis JMS TextMessages.ActiveMQTextMessage(ClientMessage message, ClientSession session)ActiveMQTextMessage(ClientSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearBody()Clears out the message body.voiddoBeforeReceive()protected <T> TgetBodyInternal(Class<T> c)StringgetText()Gets the string containing this message's data.bytegetType()booleanisBodyAssignableTo(Class c)Returns whether the message body is capable of being assigned to the specified type.voidsetText(String text)Sets the string 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, doBeforeSend, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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 Detail
-
TYPE
public static final byte TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActiveMQTextMessage
public ActiveMQTextMessage(ClientSession session)
-
ActiveMQTextMessage
public ActiveMQTextMessage(ClientMessage message, ClientSession session)
-
ActiveMQTextMessage
public ActiveMQTextMessage(TextMessage foreign, ClientSession session) throws JMSException
A copy constructor for non-ActiveMQ Artemis JMS TextMessages.- Throws:
JMSException
-
-
Method Detail
-
getType
public byte getType()
- Overrides:
getTypein classActiveMQMessage
-
setText
public void setText(String text) throws JMSException
Description copied from interface:TextMessageSets the string containing this message's data.- Specified by:
setTextin interfaceTextMessage- Parameters:
text- theStringcontaining the message's data- Throws:
JMSException- if the Jakarta Messaging provider fails to set the text due to some internal error.MessageNotWriteableException- if the message is in read-only mode.
-
getText
public String getText()
Description copied from interface:TextMessageGets the string containing this message's data. The default value is null.- Specified by:
getTextin interfaceTextMessage- Returns:
- the
Stringcontaining the message's data
-
clearBody
public void clearBody() throws JMSExceptionDescription 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.
-
doBeforeReceive
public void doBeforeReceive() throws ActiveMQException- Overrides:
doBeforeReceivein classActiveMQMessage- Throws:
ActiveMQException
-
getBodyInternal
protected <T> T getBodyInternal(Class<T> c)
- Overrides:
getBodyInternalin classActiveMQMessage
-
isBodyAssignableTo
public boolean isBodyAssignableTo(Class c)
Description copied from interface:MessageReturns whether the message body is capable of being assigned to the specified type. If this method returns true then a subsequent call to the methodgetBodyon the same message with the same type argument would not throw a MessageFormatException.If the message is a
StreamMessagethen false is always returned. If the message is aObjectMessageand object deserialization fails then false is returned. If the message has no body then any type may be specified and true is returned.- 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
-
-