org.apache.activemq.command
Class ActiveMQMessage

java.lang.Object
  extended by org.apache.activemq.command.BaseCommand
      extended by org.apache.activemq.command.Message
          extended by org.apache.activemq.command.ActiveMQMessage
All Implemented Interfaces:
Message, MessageReference, Command, DataStructure, MarshallAware, ScheduledMessage
Direct Known Subclasses:
ActiveMQBlobMessage, ActiveMQBytesMessage, ActiveMQMapMessage, ActiveMQObjectMessage, ActiveMQStreamMessage, ActiveMQTextMessage

public class ActiveMQMessage
extends Message
implements Message, ScheduledMessage


Field Summary
protected  Callback acknowledgeCallback
           
static byte DATA_STRUCTURE_TYPE
           
static String DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY
           
 
Fields inherited from class org.apache.activemq.command.Message
arrival, brokerInTime, brokerOutTime, compressed, content, correlationId, dataStructure, DEFAULT_MINIMUM_MESSAGE_SIZE, destination, droppable, expiration, groupID, groupSequence, marshalledProperties, messageId, originalDestination, originalTransactionId, persistent, priority, producerId, properties, readOnlyBody, readOnlyProperties, recievedByDFBridge, redeliveryCounter, replyTo, size, targetConsumerId, timestamp, transactionId, type, userID
 
Fields inherited from class org.apache.activemq.command.BaseCommand
commandId, responseRequired
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Fields inherited from interface org.apache.activemq.ScheduledMessage
AMQ_SCHEDULED_CRON, AMQ_SCHEDULED_DELAY, AMQ_SCHEDULED_ID, AMQ_SCHEDULED_PERIOD, AMQ_SCHEDULED_REPEAT, AMQ_SCHEDULER_ACTION, AMQ_SCHEDULER_ACTION_BROWSE, AMQ_SCHEDULER_ACTION_END_TIME, AMQ_SCHEDULER_ACTION_REMOVE, AMQ_SCHEDULER_ACTION_REMOVEALL, AMQ_SCHEDULER_ACTION_START_TIME, AMQ_SCHEDULER_MANAGEMENT_DESTINATION
 
Constructor Summary
ActiveMQMessage()
           
 
Method Summary
 void acknowledge()
           
protected  void checkReadOnlyBody()
           
protected  void checkValidObject(Object value)
           
protected  void checkValidScheduled(String name, Object value)
           
 void clearBody()
           
 void clearProperties()
           
protected  Object convertScheduled(String name, Object value)
           
 Message copy()
           
protected  void copy(ActiveMQMessage copy)
           
protected static String decodeString(byte[] data)
           
protected static byte[] encodeString(String data)
           
 boolean equals(Object o)
           
 Callback getAcknowledgeCallback()
           
 Enumeration getAllPropertyNames()
          return all property names, including standard JMS properties and JMSX properties
 boolean getBooleanProperty(String name)
           
 byte getByteProperty(String name)
           
 byte getDataStructureType()
           
 double getDoubleProperty(String name)
           
 float getFloatProperty(String name)
           
 int getIntProperty(String name)
           
 String getJMSCorrelationID()
           
 byte[] getJMSCorrelationIDAsBytes()
           
 int getJMSDeliveryMode()
           
 Destination getJMSDestination()
           
 long getJMSExpiration()
           
 String getJMSMessageID()
           
 int getJMSPriority()
           
 boolean getJMSRedelivered()
           
 Destination getJMSReplyTo()
           
 long getJMSTimestamp()
           
 String getJMSType()
           
 String getJMSXMimeType()
          Returns the MIME type of this mesage.
 long getLongProperty(String name)
           
 Object getObjectProperty(String name)
           
 Enumeration getPropertyNames()
           
 short getShortProperty(String name)
           
 String getStringProperty(String name)
           
 int hashCode()
           
 void onSend()
          Send operation event listener.
 boolean propertyExists(String name)
           
 void setAcknowledgeCallback(Callback acknowledgeCallback)
           
 void setBooleanProperty(String name, boolean value)
           
 void setBooleanProperty(String name, boolean value, boolean checkReadOnly)
           
 void setByteProperty(String name, byte value)
           
 void setDoubleProperty(String name, double value)
           
 void setFloatProperty(String name, float value)
           
 void setIntProperty(String name, int value)
           
 void setJMSCorrelationID(String correlationId)
           
 void setJMSCorrelationIDAsBytes(byte[] correlationId)
           
 void setJMSDeliveryMode(int mode)
           
 void setJMSDestination(Destination destination)
           
 void setJMSExpiration(long expiration)
           
 void setJMSMessageID(ProducerId producerId, long producerSequenceId)
          This will create an object of MessageId.
 void setJMSMessageID(String value)
          Seems to be invalid because the parameter doesn't initialize MessageId instance variables ProducerId and ProducerSequenceId
 void setJMSPriority(int priority)
           
 void setJMSRedelivered(boolean redelivered)
           
 void setJMSReplyTo(Destination destination)
           
 void setJMSTimestamp(long timestamp)
           
 void setJMSType(String type)
           
 void setLongProperty(String name, long value)
           
 void setObjectProperty(String name, Object value)
           
 void setObjectProperty(String name, Object value, boolean checkReadOnly)
           
 void setProperties(Map<String,?> properties)
           
 void setShortProperty(String name, short value)
           
 void setStringProperty(String name, String value)
           
 void storeContent()
           
 Response visit(CommandVisitor visitor)
           
 
Methods inherited from class org.apache.activemq.command.Message
afterMarshall, afterUnmarshall, beforeMarshall, beforeUnmarshall, clearMarshalledState, compress, copy, decrementReferenceCount, doCompress, getArrival, getBrokerInTime, getBrokerOutTime, getBrokerPath, getCluster, getConnection, getContent, getCorrelationId, getDataStructure, getDestination, getExpiration, getGroupID, getGroupSequence, getMarshalledProperties, getMemoryUsage, getMessage, getMessageHardRef, getMessageId, getMinimumMessageSize, getOriginalDestination, getOriginalTransactionId, getPriority, getProducerId, getProperties, getProperty, getRedeliveryCounter, getReferenceCount, getRegionDestination, getReplyTo, getSize, getTargetConsumerId, getTimestamp, getTransactionId, getType, getUserID, incrementRedeliveryCounter, incrementReferenceCount, isAdvisory, isCompressed, isDroppable, isDropped, isExpired, isInTransaction, isMarshallAware, isMessage, isPersistent, isReadOnlyBody, isReadOnlyProperties, isRecievedByDFBridge, isRedelivered, lazyCreateProperties, onMessageRolledBack, removeProperty, setArrival, setBrokerInTime, setBrokerOutTime, setBrokerPath, setCluster, setCompressed, setConnection, setContent, setCorrelationId, setDataStructure, setDestination, setDroppable, setExpiration, setGroupID, setGroupSequence, setMarshalledProperties, setMemoryUsage, setMessageId, setOriginalDestination, setOriginalTransactionId, setPersistent, setPriority, setProducerId, setProperty, setReadOnlyBody, setReadOnlyProperties, setRecievedByDFBridge, setRedelivered, setRedeliveryCounter, setRegionDestination, setReplyTo, setTargetConsumerId, setTimestamp, setTransactionId, setType, setUserID, toString, toString
 
Methods inherited from class org.apache.activemq.command.BaseCommand
copy, getCommandId, getFrom, getTo, isBrokerInfo, isConnectionControl, isMessageAck, isMessageDispatch, isMessageDispatchNotification, isResponse, isResponseRequired, isShutdownInfo, isWireFormatInfo, setCommandId, setFrom, setResponseRequired, setTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_STRUCTURE_TYPE

public static final byte DATA_STRUCTURE_TYPE
See Also:
Constant Field Values

DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY

public static final String DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY
See Also:
Constant Field Values

acknowledgeCallback

protected transient Callback acknowledgeCallback
Constructor Detail

ActiveMQMessage

public ActiveMQMessage()
Method Detail

getDataStructureType

public byte getDataStructureType()
Specified by:
getDataStructureType in interface DataStructure
Returns:
The type of the data structure

copy

public Message copy()
Specified by:
copy in class Message

copy

protected void copy(ActiveMQMessage copy)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

acknowledge

public void acknowledge()
                 throws JMSException
Specified by:
acknowledge in interface Message
Throws:
JMSException

clearBody

public void clearBody()
               throws JMSException
Specified by:
clearBody in interface Message
Specified by:
clearBody in class Message
Throws:
JMSException

getJMSMessageID

public String getJMSMessageID()
Specified by:
getJMSMessageID in interface Message

setJMSMessageID

public void setJMSMessageID(String value)
                     throws JMSException
Seems to be invalid because the parameter doesn't initialize MessageId instance variables ProducerId and ProducerSequenceId

Specified by:
setJMSMessageID in interface Message
Parameters:
value -
Throws:
JMSException

setJMSMessageID

public void setJMSMessageID(ProducerId producerId,
                            long producerSequenceId)
                     throws JMSException
This will create an object of MessageId. For it to be valid, the instance variable ProducerId and producerSequenceId must be initialized.

Parameters:
producerId -
producerSequenceId -
Throws:
JMSException

getJMSTimestamp

public long getJMSTimestamp()
Specified by:
getJMSTimestamp in interface Message

setJMSTimestamp

public void setJMSTimestamp(long timestamp)
Specified by:
setJMSTimestamp in interface Message

getJMSCorrelationID

public String getJMSCorrelationID()
Specified by:
getJMSCorrelationID in interface Message

setJMSCorrelationID

public void setJMSCorrelationID(String correlationId)
Specified by:
setJMSCorrelationID in interface Message

getJMSCorrelationIDAsBytes

public byte[] getJMSCorrelationIDAsBytes()
                                  throws JMSException
Specified by:
getJMSCorrelationIDAsBytes in interface Message
Throws:
JMSException

setJMSCorrelationIDAsBytes

public void setJMSCorrelationIDAsBytes(byte[] correlationId)
                                throws JMSException
Specified by:
setJMSCorrelationIDAsBytes in interface Message
Throws:
JMSException

getJMSXMimeType

public String getJMSXMimeType()
Description copied from interface: Message
Returns the MIME type of this mesage. This can be used in selectors to filter on the MIME types of the different JMS messages, or in the case of BlobMessage it allows you to create a selector on the MIME type of the BLOB body


decodeString

protected static String decodeString(byte[] data)
                              throws JMSException
Throws:
JMSException

encodeString

protected static byte[] encodeString(String data)
                              throws JMSException
Throws:
JMSException

getJMSReplyTo

public Destination getJMSReplyTo()
Specified by:
getJMSReplyTo in interface Message

setJMSReplyTo

public void setJMSReplyTo(Destination destination)
                   throws JMSException
Specified by:
setJMSReplyTo in interface Message
Throws:
JMSException

getJMSDestination

public Destination getJMSDestination()
Specified by:
getJMSDestination in interface Message

setJMSDestination

public void setJMSDestination(Destination destination)
                       throws JMSException
Specified by:
setJMSDestination in interface Message
Throws:
JMSException

getJMSDeliveryMode

public int getJMSDeliveryMode()
Specified by:
getJMSDeliveryMode in interface Message

setJMSDeliveryMode

public void setJMSDeliveryMode(int mode)
Specified by:
setJMSDeliveryMode in interface Message

getJMSRedelivered

public boolean getJMSRedelivered()
Specified by:
getJMSRedelivered in interface Message

setJMSRedelivered

public void setJMSRedelivered(boolean redelivered)
Specified by:
setJMSRedelivered in interface Message

getJMSType

public String getJMSType()
Specified by:
getJMSType in interface Message

setJMSType

public void setJMSType(String type)
Specified by:
setJMSType in interface Message

getJMSExpiration

public long getJMSExpiration()
Specified by:
getJMSExpiration in interface Message

setJMSExpiration

public void setJMSExpiration(long expiration)
Specified by:
setJMSExpiration in interface Message

getJMSPriority

public int getJMSPriority()
Specified by:
getJMSPriority in interface Message

setJMSPriority

public void setJMSPriority(int priority)
Specified by:
setJMSPriority in interface Message

clearProperties

public void clearProperties()
Specified by:
clearProperties in interface Message
Overrides:
clearProperties in class Message

propertyExists

public boolean propertyExists(String name)
                       throws JMSException
Specified by:
propertyExists in interface Message
Throws:
JMSException

getPropertyNames

public Enumeration getPropertyNames()
                             throws JMSException
Specified by:
getPropertyNames in interface Message
Throws:
JMSException

getAllPropertyNames

public Enumeration getAllPropertyNames()
                                throws JMSException
return all property names, including standard JMS properties and JMSX properties

Returns:
Enumeration of all property names on this message
Throws:
JMSException

setObjectProperty

public void setObjectProperty(String name,
                              Object value)
                       throws JMSException
Specified by:
setObjectProperty in interface Message
Throws:
JMSException

setObjectProperty

public void setObjectProperty(String name,
                              Object value,
                              boolean checkReadOnly)
                       throws JMSException
Throws:
JMSException

setProperties

public void setProperties(Map<String,?> properties)
                   throws JMSException
Throws:
JMSException

checkValidObject

protected void checkValidObject(Object value)
                         throws MessageFormatException
Throws:
MessageFormatException

checkValidScheduled

protected void checkValidScheduled(String name,
                                   Object value)
                            throws MessageFormatException
Throws:
MessageFormatException

convertScheduled

protected Object convertScheduled(String name,
                                  Object value)
                           throws MessageFormatException
Throws:
MessageFormatException

getObjectProperty

public Object getObjectProperty(String name)
                         throws JMSException
Specified by:
getObjectProperty in interface Message
Throws:
JMSException

getBooleanProperty

public boolean getBooleanProperty(String name)
                           throws JMSException
Specified by:
getBooleanProperty in interface Message
Throws:
JMSException

getByteProperty

public byte getByteProperty(String name)
                     throws JMSException
Specified by:
getByteProperty in interface Message
Throws:
JMSException

getShortProperty

public short getShortProperty(String name)
                       throws JMSException
Specified by:
getShortProperty in interface Message
Throws:
JMSException

getIntProperty

public int getIntProperty(String name)
                   throws JMSException
Specified by:
getIntProperty in interface Message
Throws:
JMSException

getLongProperty

public long getLongProperty(String name)
                     throws JMSException
Specified by:
getLongProperty in interface Message
Throws:
JMSException

getFloatProperty

public float getFloatProperty(String name)
                       throws JMSException
Specified by:
getFloatProperty in interface Message
Throws:
JMSException

getDoubleProperty

public double getDoubleProperty(String name)
                         throws JMSException
Specified by:
getDoubleProperty in interface Message
Throws:
JMSException

getStringProperty

public String getStringProperty(String name)
                         throws JMSException
Specified by:
getStringProperty in interface Message
Throws:
JMSException

setBooleanProperty

public void setBooleanProperty(String name,
                               boolean value)
                        throws JMSException
Specified by:
setBooleanProperty in interface Message
Throws:
JMSException

setBooleanProperty

public void setBooleanProperty(String name,
                               boolean value,
                               boolean checkReadOnly)
                        throws JMSException
Throws:
JMSException

setByteProperty

public void setByteProperty(String name,
                            byte value)
                     throws JMSException
Specified by:
setByteProperty in interface Message
Throws:
JMSException

setShortProperty

public void setShortProperty(String name,
                             short value)
                      throws JMSException
Specified by:
setShortProperty in interface Message
Throws:
JMSException

setIntProperty

public void setIntProperty(String name,
                           int value)
                    throws JMSException
Specified by:
setIntProperty in interface Message
Throws:
JMSException

setLongProperty

public void setLongProperty(String name,
                            long value)
                     throws JMSException
Specified by:
setLongProperty in interface Message
Throws:
JMSException

setFloatProperty

public void setFloatProperty(String name,
                             float value)
                      throws JMSException
Specified by:
setFloatProperty in interface Message
Throws:
JMSException

setDoubleProperty

public void setDoubleProperty(String name,
                              double value)
                       throws JMSException
Specified by:
setDoubleProperty in interface Message
Throws:
JMSException

setStringProperty

public void setStringProperty(String name,
                              String value)
                       throws JMSException
Specified by:
setStringProperty in interface Message
Throws:
JMSException

checkReadOnlyBody

protected void checkReadOnlyBody()
                          throws MessageNotWriteableException
Throws:
MessageNotWriteableException

getAcknowledgeCallback

public Callback getAcknowledgeCallback()

setAcknowledgeCallback

public void setAcknowledgeCallback(Callback acknowledgeCallback)

onSend

public void onSend()
            throws JMSException
Send operation event listener. Used to get the message ready to be sent.

Throws:
JMSException

visit

public Response visit(CommandVisitor visitor)
               throws Exception
Specified by:
visit in interface Command
Throws:
Exception

storeContent

public void storeContent()
Specified by:
storeContent in class Message


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.