Package org.apache.qpid.jms.message
Class JmsMessage
- java.lang.Object
-
- org.apache.qpid.jms.message.JmsMessage
-
- All Implemented Interfaces:
javax.jms.Message
- Direct Known Subclasses:
JmsBytesMessage,JmsMapMessage,JmsObjectMessage,JmsStreamMessage,JmsTextMessage
public class JmsMessage extends Object implements javax.jms.Message
-
-
Field Summary
Fields Modifier and Type Field Description protected JmsAcknowledgeCallbackacknowledgeCallbackprotected JmsConnectionconnectionprotected JmsMessageFacadefacadeprotected booleanreadOnlyprotected booleanreadOnlyBodyprotected booleanreadOnlyPropertiesprotected booleanvalidatePropertyNames
-
Constructor Summary
Constructors Constructor Description JmsMessage(JmsMessageFacade facade)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledge()protected voidcheckReadOnly()protected voidcheckReadOnlyBody()protected voidcheckReadOnlyProperties()protected voidcheckWriteOnlyBody()voidclearBody()voidclearProperties()JmsMessagecopy()protected voidcopy(JmsMessage other)protected <T> TdoGetBody(Class<T> asType)booleanequals(Object o)JmsAcknowledgeCallbackgetAcknowledgeCallback()Enumeration<?>getAllPropertyNames()return all property names, including standard JMS properties and JMSX properties<T> TgetBody(Class<T> asType)booleangetBooleanProperty(String name)bytegetByteProperty(String name)JmsConnectiongetConnection()doublegetDoubleProperty(String name)JmsMessageFacadegetFacade()floatgetFloatProperty(String name)intgetIntProperty(String name)StringgetJMSCorrelationID()byte[]getJMSCorrelationIDAsBytes()intgetJMSDeliveryMode()longgetJMSDeliveryTime()javax.jms.DestinationgetJMSDestination()longgetJMSExpiration()StringgetJMSMessageID()intgetJMSPriority()booleangetJMSRedelivered()javax.jms.DestinationgetJMSReplyTo()longgetJMSTimestamp()StringgetJMSType()longgetLongProperty(String name)ObjectgetObjectProperty(String name)Enumeration<?>getPropertyNames()shortgetShortProperty(String name)StringgetStringProperty(String name)inthashCode()booleanisBodyAssignableTo(Class target)booleanisExpired()booleanisReadOnly()booleanisReadOnlyBody()booleanisReadOnlyProperties()booleanisValidatePropertyNames()voidonDispatch()Used to trigger processing required before dispatch of a message to its intended consumer.voidonSend(long producerTtl)Used to trigger processing required to place the message in a state where it is ready to be written to the wire.voidonSendComplete()Used to trigger processing required to place the message into a writable state once again following completion of the send operation.booleanpropertyExists(String name)voidsetAcknowledgeCallback(JmsAcknowledgeCallback jmsAcknowledgeCallback)voidsetBooleanProperty(String name, boolean value)voidsetByteProperty(String name, byte value)voidsetConnection(JmsConnection connection)voidsetDoubleProperty(String name, double value)voidsetFloatProperty(String name, float value)voidsetIntProperty(String name, int value)voidsetJMSCorrelationID(String correlationId)voidsetJMSCorrelationIDAsBytes(byte[] correlationId)voidsetJMSDeliveryMode(int mode)voidsetJMSDeliveryTime(long deliveryTime)voidsetJMSDestination(javax.jms.Destination destination)voidsetJMSExpiration(long expiration)voidsetJMSMessageID(String value)voidsetJMSPriority(int priority)voidsetJMSRedelivered(boolean redelivered)voidsetJMSReplyTo(javax.jms.Destination destination)voidsetJMSTimestamp(long timestamp)voidsetJMSType(String type)voidsetLongProperty(String name, long value)voidsetObjectProperty(String name, Object value)voidsetReadOnly(boolean readOnly)voidsetReadOnlyBody(boolean readOnlyBody)voidsetReadOnlyProperties(boolean readOnlyProperties)voidsetShortProperty(String name, short value)voidsetStringProperty(String name, String value)voidsetValidatePropertyNames(boolean validatePropertyNames)StringtoString()
-
-
-
Field Detail
-
acknowledgeCallback
protected transient JmsAcknowledgeCallback acknowledgeCallback
-
connection
protected transient JmsConnection connection
-
facade
protected final JmsMessageFacade facade
-
readOnly
protected boolean readOnly
-
readOnlyBody
protected boolean readOnlyBody
-
readOnlyProperties
protected boolean readOnlyProperties
-
validatePropertyNames
protected boolean validatePropertyNames
-
-
Constructor Detail
-
JmsMessage
public JmsMessage(JmsMessageFacade facade)
-
-
Method Detail
-
copy
public JmsMessage copy() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
copy
protected void copy(JmsMessage other)
-
acknowledge
public void acknowledge() throws javax.jms.JMSException- Specified by:
acknowledgein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
isBodyAssignableTo
public boolean isBodyAssignableTo(Class target) throws javax.jms.JMSException
- Specified by:
isBodyAssignableToin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getBody
public final <T> T getBody(Class<T> asType) throws javax.jms.JMSException
- Specified by:
getBodyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
doGetBody
protected <T> T doGetBody(Class<T> asType) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
clearBody
public void clearBody() throws javax.jms.JMSException- Specified by:
clearBodyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
isValidatePropertyNames
public boolean isValidatePropertyNames()
-
setValidatePropertyNames
public void setValidatePropertyNames(boolean validatePropertyNames)
-
isReadOnly
public boolean isReadOnly()
-
setReadOnly
public void setReadOnly(boolean readOnly)
-
isReadOnlyBody
public boolean isReadOnlyBody()
-
setReadOnlyBody
public void setReadOnlyBody(boolean readOnlyBody)
-
isReadOnlyProperties
public boolean isReadOnlyProperties()
-
setReadOnlyProperties
public void setReadOnlyProperties(boolean readOnlyProperties)
-
getJMSMessageID
public String getJMSMessageID() throws javax.jms.JMSException
- Specified by:
getJMSMessageIDin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSMessageID
public void setJMSMessageID(String value) throws javax.jms.JMSException
- Specified by:
setJMSMessageIDin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSTimestamp
public long getJMSTimestamp() throws javax.jms.JMSException- Specified by:
getJMSTimestampin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSTimestamp
public void setJMSTimestamp(long timestamp) throws javax.jms.JMSException- Specified by:
setJMSTimestampin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSCorrelationID
public String getJMSCorrelationID() throws javax.jms.JMSException
- Specified by:
getJMSCorrelationIDin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSCorrelationID
public void setJMSCorrelationID(String correlationId) throws javax.jms.JMSException
- Specified by:
setJMSCorrelationIDin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSCorrelationIDAsBytes
public byte[] getJMSCorrelationIDAsBytes() throws javax.jms.JMSException- Specified by:
getJMSCorrelationIDAsBytesin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSCorrelationIDAsBytes
public void setJMSCorrelationIDAsBytes(byte[] correlationId) throws javax.jms.JMSException- Specified by:
setJMSCorrelationIDAsBytesin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSReplyTo
public javax.jms.Destination getJMSReplyTo() throws javax.jms.JMSException- Specified by:
getJMSReplyToin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSReplyTo
public void setJMSReplyTo(javax.jms.Destination destination) throws javax.jms.JMSException- Specified by:
setJMSReplyToin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSDestination
public javax.jms.Destination getJMSDestination() throws javax.jms.JMSException- Specified by:
getJMSDestinationin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSDestination
public void setJMSDestination(javax.jms.Destination destination) throws javax.jms.JMSException- Specified by:
setJMSDestinationin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSDeliveryMode
public int getJMSDeliveryMode() throws javax.jms.JMSException- Specified by:
getJMSDeliveryModein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSDeliveryMode
public void setJMSDeliveryMode(int mode) throws javax.jms.JMSException- Specified by:
setJMSDeliveryModein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSRedelivered
public boolean getJMSRedelivered() throws javax.jms.JMSException- Specified by:
getJMSRedeliveredin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSRedelivered
public void setJMSRedelivered(boolean redelivered) throws javax.jms.JMSException- Specified by:
setJMSRedeliveredin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSType
public String getJMSType() throws javax.jms.JMSException
- Specified by:
getJMSTypein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSType
public void setJMSType(String type) throws javax.jms.JMSException
- Specified by:
setJMSTypein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSExpiration
public long getJMSExpiration() throws javax.jms.JMSException- Specified by:
getJMSExpirationin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSExpiration
public void setJMSExpiration(long expiration) throws javax.jms.JMSException- Specified by:
setJMSExpirationin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSPriority
public int getJMSPriority() throws javax.jms.JMSException- Specified by:
getJMSPriorityin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSPriority
public void setJMSPriority(int priority) throws javax.jms.JMSException- Specified by:
setJMSPriorityin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSDeliveryTime
public long getJMSDeliveryTime() throws javax.jms.JMSException- Specified by:
getJMSDeliveryTimein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSDeliveryTime
public void setJMSDeliveryTime(long deliveryTime) throws javax.jms.JMSException- Specified by:
setJMSDeliveryTimein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
clearProperties
public void clearProperties() throws javax.jms.JMSException- Specified by:
clearPropertiesin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
propertyExists
public boolean propertyExists(String name) throws javax.jms.JMSException
- Specified by:
propertyExistsin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getPropertyNames
public Enumeration<?> getPropertyNames() throws javax.jms.JMSException
- Specified by:
getPropertyNamesin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getAllPropertyNames
public Enumeration<?> getAllPropertyNames() throws javax.jms.JMSException
return all property names, including standard JMS properties and JMSX properties- Returns:
- Enumeration of all property names on this message
- Throws:
javax.jms.JMSException- if an error occurs while reading the properties from the Message.
-
setObjectProperty
public void setObjectProperty(String name, Object value) throws javax.jms.JMSException
- Specified by:
setObjectPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getObjectProperty
public Object getObjectProperty(String name) throws javax.jms.JMSException
- Specified by:
getObjectPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getBooleanProperty
public boolean getBooleanProperty(String name) throws javax.jms.JMSException
- Specified by:
getBooleanPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getByteProperty
public byte getByteProperty(String name) throws javax.jms.JMSException
- Specified by:
getBytePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getShortProperty
public short getShortProperty(String name) throws javax.jms.JMSException
- Specified by:
getShortPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getIntProperty
public int getIntProperty(String name) throws javax.jms.JMSException
- Specified by:
getIntPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getLongProperty
public long getLongProperty(String name) throws javax.jms.JMSException
- Specified by:
getLongPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getFloatProperty
public float getFloatProperty(String name) throws javax.jms.JMSException
- Specified by:
getFloatPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getDoubleProperty
public double getDoubleProperty(String name) throws javax.jms.JMSException
- Specified by:
getDoublePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getStringProperty
public String getStringProperty(String name) throws javax.jms.JMSException
- Specified by:
getStringPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setBooleanProperty
public void setBooleanProperty(String name, boolean value) throws javax.jms.JMSException
- Specified by:
setBooleanPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setByteProperty
public void setByteProperty(String name, byte value) throws javax.jms.JMSException
- Specified by:
setBytePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setShortProperty
public void setShortProperty(String name, short value) throws javax.jms.JMSException
- Specified by:
setShortPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setIntProperty
public void setIntProperty(String name, int value) throws javax.jms.JMSException
- Specified by:
setIntPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setLongProperty
public void setLongProperty(String name, long value) throws javax.jms.JMSException
- Specified by:
setLongPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setFloatProperty
public void setFloatProperty(String name, float value) throws javax.jms.JMSException
- Specified by:
setFloatPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setDoubleProperty
public void setDoubleProperty(String name, double value) throws javax.jms.JMSException
- Specified by:
setDoublePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setStringProperty
public void setStringProperty(String name, String value) throws javax.jms.JMSException
- Specified by:
setStringPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getAcknowledgeCallback
public JmsAcknowledgeCallback getAcknowledgeCallback()
-
setAcknowledgeCallback
public void setAcknowledgeCallback(JmsAcknowledgeCallback jmsAcknowledgeCallback)
-
onSend
public void onSend(long producerTtl) throws javax.jms.JMSExceptionUsed to trigger processing required to place the message in a state where it is ready to be written to the wire. This processing can include such tasks as ensuring that the proper message headers are set or compressing message bodies etc. During this call the message is placed in a read-only mode and will not be returned to a writable state until send completion is triggered.- Parameters:
producerTtl- the time to live value that the producer was configured with at send time.- Throws:
javax.jms.JMSException- if an error occurs while preparing the message for send.
-
onSendComplete
public void onSendComplete()
Used to trigger processing required to place the message into a writable state once again following completion of the send operation.
-
onDispatch
public void onDispatch() throws javax.jms.JMSExceptionUsed to trigger processing required before dispatch of a message to its intended consumer. This method should perform any needed decoding or message property processing prior to the message arriving at a consumer.- Throws:
javax.jms.JMSException- if an error occurs while preparing the message for dispatch.
-
getConnection
public JmsConnection getConnection()
-
setConnection
public void setConnection(JmsConnection connection)
-
getFacade
public JmsMessageFacade getFacade()
-
isExpired
public boolean isExpired()
-
checkReadOnly
protected void checkReadOnly() throws javax.jms.MessageNotWriteableException- Throws:
javax.jms.MessageNotWriteableException
-
checkReadOnlyProperties
protected void checkReadOnlyProperties() throws javax.jms.MessageNotWriteableException- Throws:
javax.jms.MessageNotWriteableException
-
checkReadOnlyBody
protected void checkReadOnlyBody() throws javax.jms.MessageNotWriteableException- Throws:
javax.jms.MessageNotWriteableException
-
checkWriteOnlyBody
protected void checkWriteOnlyBody() throws javax.jms.MessageNotReadableException- Throws:
javax.jms.MessageNotReadableException
-
-