Class ActiveMQMessage
- java.lang.Object
-
- org.apache.activemq.artemis.jms.client.ActiveMQMessage
-
- All Implemented Interfaces:
javax.jms.Message
- Direct Known Subclasses:
ActiveMQBytesMessage
,ActiveMQCompatibleMessage
,ActiveMQMapMessage
,ActiveMQObjectMessage
,ActiveMQStreamMessage
,ActiveMQTextMessage
public class ActiveMQMessage extends java.lang.Object implements javax.jms.Message
ActiveMQ Artemis implementation of a JMS Message.
JMS Messages only live on the client side - the server only deals with MessageImpl instances
-
-
Field Summary
Fields Modifier and Type Field Description protected ClientMessage
message
static org.apache.activemq.artemis.api.core.SimpleString
OLD_QUEUE_QUALIFIED_PREFIX
static org.apache.activemq.artemis.api.core.SimpleString
OLD_TEMP_QUEUE_QUALIFED_PREFIX
static org.apache.activemq.artemis.api.core.SimpleString
OLD_TEMP_TOPIC_QUALIFED_PREFIX
static org.apache.activemq.artemis.api.core.SimpleString
OLD_TOPIC_QUALIFIED_PREFIX
protected boolean
propertiesReadOnly
protected boolean
readOnly
protected javax.jms.Destination
replyTo
static byte
TYPE
-
Constructor Summary
Constructors Modifier Constructor Description ActiveMQMessage()
protected
ActiveMQMessage(byte type, ClientSession session)
protected
ActiveMQMessage(javax.jms.Message foreign, byte type, ClientSession session)
ActiveMQMessage(javax.jms.Message foreign, ClientSession session)
ActiveMQMessage(ClientMessage message, ClientSession session)
Constructor for when receiving a message from the serverprotected
ActiveMQMessage(ClientSession session)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledge()
void
checkBuffer()
protected org.apache.activemq.artemis.api.core.SimpleString
checkPrefix(org.apache.activemq.artemis.api.core.SimpleString address)
protected org.apache.activemq.artemis.api.core.SimpleString
checkPrefixStr(org.apache.activemq.artemis.api.core.SimpleString address)
protected void
checkRead()
protected void
checkWrite()
void
clearBody()
void
clearProperties()
static javax.management.openmbean.CompositeData
coreCompositeTypeToJMSCompositeType(javax.management.openmbean.CompositeDataSupport data)
static java.util.Map<java.lang.String,java.lang.Object>
coreMaptoJMSMap(java.util.Map<java.lang.String,java.lang.Object> coreMessage)
static ActiveMQMessage
createMessage(ClientMessage message, ClientSession session)
static ActiveMQMessage
createMessage(ClientMessage message, ClientSession session, ConnectionFactoryOptions options)
void
doBeforeReceive()
void
doBeforeSend()
<T> T
getBody(java.lang.Class<T> c)
protected <T> T
getBodyInternal(java.lang.Class<T> c)
boolean
getBooleanProperty(java.lang.String name)
byte
getByteProperty(java.lang.String name)
ClientMessage
getCoreMessage()
double
getDoubleProperty(java.lang.String name)
float
getFloatProperty(java.lang.String name)
int
getIntProperty(java.lang.String name)
java.lang.String
getJMSCorrelationID()
byte[]
getJMSCorrelationIDAsBytes()
int
getJMSDeliveryMode()
long
getJMSDeliveryTime()
javax.jms.Destination
getJMSDestination()
long
getJMSExpiration()
java.lang.String
getJMSMessageID()
int
getJMSPriority()
boolean
getJMSRedelivered()
javax.jms.Destination
getJMSReplyTo()
long
getJMSTimestamp()
java.lang.String
getJMSType()
long
getLongProperty(java.lang.String name)
java.lang.Object
getObjectProperty(java.lang.String name)
java.util.Enumeration
getPropertyNames()
short
getShortProperty(java.lang.String name)
java.lang.String
getStringProperty(java.lang.String name)
byte
getType()
protected boolean
hasNoBody()
Helper method forisBodyAssignableTo(Class)
.boolean
isBodyAssignableTo(java.lang.Class c)
static java.lang.String
prefixOf(javax.jms.Destination dest)
boolean
propertyExists(java.lang.String name)
void
resetMessageID(java.lang.String newMsgID)
void
saveToOutputStream(java.io.OutputStream output)
void
setBooleanProperty(java.lang.String name, boolean value)
void
setByteProperty(java.lang.String name, byte value)
void
setClientAcknowledge()
void
setDoubleProperty(java.lang.String name, double value)
void
setFloatProperty(java.lang.String name, float value)
void
setIndividualAcknowledge()
void
setInputStream(java.io.InputStream input)
void
setIntProperty(java.lang.String name, int value)
void
setJMSCorrelationID(java.lang.String correlationID)
void
setJMSCorrelationIDAsBytes(byte[] correlationID)
void
setJMSDeliveryMode(int deliveryMode)
void
setJMSDeliveryTime(long deliveryTime)
void
setJMSDestination(javax.jms.Destination destination)
void
setJMSExpiration(long expiration)
void
setJMSMessageID(java.lang.String jmsMessageID)
void
setJMSPriority(int priority)
void
setJMSRedelivered(boolean redelivered)
void
setJMSReplyTo(javax.jms.Destination dest)
void
setJMSTimestamp(long timestamp)
void
setJMSType(java.lang.String type)
void
setLongProperty(java.lang.String name, long value)
void
setObjectProperty(java.lang.String name, java.lang.Object value)
void
setOutputStream(java.io.OutputStream output)
void
setShortProperty(java.lang.String name, short value)
void
setStringProperty(java.lang.String name, java.lang.String value)
java.lang.String
toString()
boolean
waitCompletionOnStream(long timeWait)
-
-
-
Field Detail
-
TYPE
public static final byte TYPE
- See Also:
- Constant Field Values
-
OLD_QUEUE_QUALIFIED_PREFIX
public static final org.apache.activemq.artemis.api.core.SimpleString OLD_QUEUE_QUALIFIED_PREFIX
-
OLD_TEMP_QUEUE_QUALIFED_PREFIX
public static final org.apache.activemq.artemis.api.core.SimpleString OLD_TEMP_QUEUE_QUALIFED_PREFIX
-
OLD_TOPIC_QUALIFIED_PREFIX
public static final org.apache.activemq.artemis.api.core.SimpleString OLD_TOPIC_QUALIFIED_PREFIX
-
OLD_TEMP_TOPIC_QUALIFED_PREFIX
public static final org.apache.activemq.artemis.api.core.SimpleString OLD_TEMP_TOPIC_QUALIFED_PREFIX
-
message
protected ClientMessage message
-
readOnly
protected boolean readOnly
-
propertiesReadOnly
protected boolean propertiesReadOnly
-
replyTo
protected javax.jms.Destination replyTo
-
-
Constructor Detail
-
ActiveMQMessage
protected ActiveMQMessage(byte type, ClientSession session)
-
ActiveMQMessage
protected ActiveMQMessage(ClientSession session)
-
ActiveMQMessage
public ActiveMQMessage(ClientMessage message, ClientSession session)
Constructor for when receiving a message from the server
-
ActiveMQMessage
public ActiveMQMessage(javax.jms.Message foreign, ClientSession session) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
ActiveMQMessage
public ActiveMQMessage()
-
ActiveMQMessage
protected ActiveMQMessage(javax.jms.Message foreign, byte type, ClientSession session) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
-
Method Detail
-
coreMaptoJMSMap
public static java.util.Map<java.lang.String,java.lang.Object> coreMaptoJMSMap(java.util.Map<java.lang.String,java.lang.Object> coreMessage)
-
coreCompositeTypeToJMSCompositeType
public static javax.management.openmbean.CompositeData coreCompositeTypeToJMSCompositeType(javax.management.openmbean.CompositeDataSupport data) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createMessage
public static ActiveMQMessage createMessage(ClientMessage message, ClientSession session)
-
createMessage
public static ActiveMQMessage createMessage(ClientMessage message, ClientSession session, ConnectionFactoryOptions options)
-
getJMSMessageID
public java.lang.String getJMSMessageID()
- Specified by:
getJMSMessageID
in interfacejavax.jms.Message
-
setJMSMessageID
public void setJMSMessageID(java.lang.String jmsMessageID) throws javax.jms.JMSException
- Specified by:
setJMSMessageID
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSTimestamp
public long getJMSTimestamp() throws javax.jms.JMSException
- Specified by:
getJMSTimestamp
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSTimestamp
public void setJMSTimestamp(long timestamp) throws javax.jms.JMSException
- Specified by:
setJMSTimestamp
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSCorrelationIDAsBytes
public byte[] getJMSCorrelationIDAsBytes() throws javax.jms.JMSException
- Specified by:
getJMSCorrelationIDAsBytes
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSCorrelationIDAsBytes
public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws javax.jms.JMSException
- Specified by:
setJMSCorrelationIDAsBytes
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSCorrelationID
public void setJMSCorrelationID(java.lang.String correlationID) throws javax.jms.JMSException
- Specified by:
setJMSCorrelationID
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSCorrelationID
public java.lang.String getJMSCorrelationID() throws javax.jms.JMSException
- Specified by:
getJMSCorrelationID
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSReplyTo
public javax.jms.Destination getJMSReplyTo() throws javax.jms.JMSException
- Specified by:
getJMSReplyTo
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSReplyTo
public void setJMSReplyTo(javax.jms.Destination dest) throws javax.jms.JMSException
- Specified by:
setJMSReplyTo
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
prefixOf
public static java.lang.String prefixOf(javax.jms.Destination dest)
-
checkPrefix
protected org.apache.activemq.artemis.api.core.SimpleString checkPrefix(org.apache.activemq.artemis.api.core.SimpleString address)
-
checkPrefixStr
protected org.apache.activemq.artemis.api.core.SimpleString checkPrefixStr(org.apache.activemq.artemis.api.core.SimpleString address)
-
getJMSDestination
public javax.jms.Destination getJMSDestination() throws javax.jms.JMSException
- Specified by:
getJMSDestination
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSDestination
public void setJMSDestination(javax.jms.Destination destination) throws javax.jms.JMSException
- Specified by:
setJMSDestination
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSDeliveryMode
public int getJMSDeliveryMode() throws javax.jms.JMSException
- Specified by:
getJMSDeliveryMode
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSDeliveryMode
public void setJMSDeliveryMode(int deliveryMode) throws javax.jms.JMSException
- Specified by:
setJMSDeliveryMode
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSRedelivered
public boolean getJMSRedelivered() throws javax.jms.JMSException
- Specified by:
getJMSRedelivered
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSRedelivered
public void setJMSRedelivered(boolean redelivered) throws javax.jms.JMSException
- Specified by:
setJMSRedelivered
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSType
public void setJMSType(java.lang.String type) throws javax.jms.JMSException
- Specified by:
setJMSType
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSType
public java.lang.String getJMSType() throws javax.jms.JMSException
- Specified by:
getJMSType
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSExpiration
public long getJMSExpiration() throws javax.jms.JMSException
- Specified by:
getJMSExpiration
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSExpiration
public void setJMSExpiration(long expiration) throws javax.jms.JMSException
- Specified by:
setJMSExpiration
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSPriority
public int getJMSPriority() throws javax.jms.JMSException
- Specified by:
getJMSPriority
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSPriority
public void setJMSPriority(int priority) throws javax.jms.JMSException
- Specified by:
setJMSPriority
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
clearProperties
public void clearProperties() throws javax.jms.JMSException
- Specified by:
clearProperties
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
clearBody
public void clearBody() throws javax.jms.JMSException
- Specified by:
clearBody
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
propertyExists
public boolean propertyExists(java.lang.String name) throws javax.jms.JMSException
- Specified by:
propertyExists
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getBooleanProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getByteProperty
public byte getByteProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getByteProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getShortProperty
public short getShortProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getShortProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getIntProperty
public int getIntProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getIntProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getLongProperty
public long getLongProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getLongProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getFloatProperty
public float getFloatProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getFloatProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getDoubleProperty
public double getDoubleProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getDoubleProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getStringProperty
public java.lang.String getStringProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getStringProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getObjectProperty
public java.lang.Object getObjectProperty(java.lang.String name) throws javax.jms.JMSException
- Specified by:
getObjectProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getPropertyNames
public java.util.Enumeration getPropertyNames() throws javax.jms.JMSException
- Specified by:
getPropertyNames
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setBooleanProperty
public void setBooleanProperty(java.lang.String name, boolean value) throws javax.jms.JMSException
- Specified by:
setBooleanProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setByteProperty
public void setByteProperty(java.lang.String name, byte value) throws javax.jms.JMSException
- Specified by:
setByteProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setShortProperty
public void setShortProperty(java.lang.String name, short value) throws javax.jms.JMSException
- Specified by:
setShortProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setIntProperty
public void setIntProperty(java.lang.String name, int value) throws javax.jms.JMSException
- Specified by:
setIntProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setLongProperty
public void setLongProperty(java.lang.String name, long value) throws javax.jms.JMSException
- Specified by:
setLongProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setFloatProperty
public void setFloatProperty(java.lang.String name, float value) throws javax.jms.JMSException
- Specified by:
setFloatProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setDoubleProperty
public void setDoubleProperty(java.lang.String name, double value) throws javax.jms.JMSException
- Specified by:
setDoubleProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setStringProperty
public void setStringProperty(java.lang.String name, java.lang.String value) throws javax.jms.JMSException
- Specified by:
setStringProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setObjectProperty
public void setObjectProperty(java.lang.String name, java.lang.Object value) throws javax.jms.JMSException
- Specified by:
setObjectProperty
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
acknowledge
public void acknowledge() throws javax.jms.JMSException
- Specified by:
acknowledge
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getJMSDeliveryTime
public long getJMSDeliveryTime() throws javax.jms.JMSException
- Specified by:
getJMSDeliveryTime
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
setJMSDeliveryTime
public void setJMSDeliveryTime(long deliveryTime) throws javax.jms.JMSException
- Specified by:
setJMSDeliveryTime
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getBody
public <T> T getBody(java.lang.Class<T> c) throws javax.jms.JMSException
- Specified by:
getBody
in interfacejavax.jms.Message
- Throws:
javax.jms.JMSException
-
getBodyInternal
protected <T> T getBodyInternal(java.lang.Class<T> c) throws javax.jms.MessageFormatException
- Throws:
javax.jms.MessageFormatException
-
isBodyAssignableTo
public boolean isBodyAssignableTo(java.lang.Class c)
- Specified by:
isBodyAssignableTo
in interfacejavax.jms.Message
-
hasNoBody
protected boolean hasNoBody()
Helper method forisBodyAssignableTo(Class)
.- Returns:
- true if the message has no body.
-
setIndividualAcknowledge
public void setIndividualAcknowledge()
-
setClientAcknowledge
public void setClientAcknowledge()
-
resetMessageID
public void resetMessageID(java.lang.String newMsgID)
-
getCoreMessage
public ClientMessage getCoreMessage()
-
doBeforeSend
public void doBeforeSend() throws java.lang.Exception
- Throws:
java.lang.Exception
-
checkBuffer
public void checkBuffer()
-
doBeforeReceive
public void doBeforeReceive() throws org.apache.activemq.artemis.api.core.ActiveMQException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
getType
public byte getType()
-
setInputStream
public void setInputStream(java.io.InputStream input) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
setOutputStream
public void setOutputStream(java.io.OutputStream output) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
saveToOutputStream
public void saveToOutputStream(java.io.OutputStream output) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
waitCompletionOnStream
public boolean waitCompletionOnStream(long timeWait) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
checkWrite
protected void checkWrite() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
checkRead
protected void checkRead() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
-