Package org.apache.activemq.command
Class ActiveMQMessage
- java.lang.Object
-
- org.apache.activemq.command.BaseCommand
-
- org.apache.activemq.command.Message
-
- org.apache.activemq.command.ActiveMQMessage
-
- All Implemented Interfaces:
Message,MessageReference,Command,DataStructure,MarshallAware,Message,ScheduledMessage
- Direct Known Subclasses:
ActiveMQBlobMessage,ActiveMQBytesMessage,ActiveMQMapMessage,ActiveMQObjectMessage,ActiveMQStreamMessage,ActiveMQTextMessage
public class ActiveMQMessage extends Message implements Message, ScheduledMessage
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.activemq.command.Message
Message.MessageDestination
-
-
Field Summary
Fields Modifier and Type Field Description protected CallbackacknowledgeCallbackstatic StringBROKER_PATH_PROPERTYstatic byteDATA_STRUCTURE_TYPEstatic StringDLQ_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, jmsXGroupFirstForConsumer, marshalledProperties, messageId, ORIGINAL_EXPIRATION, 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
Constructors Constructor Description ActiveMQMessage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledge()protected voidcheckReadOnlyBody()protected voidcheckReadOnlyProperties()protected voidcheckValidObject(Object value)voidclearBody()voidclearProperties()protected ObjectconvertScheduled(String name, Object value)Messagecopy()protected voidcopy(ActiveMQMessage copy)protected static StringdecodeString(byte[] data)protected static byte[]encodeString(String data)booleanequals(Object o)CallbackgetAcknowledgeCallback()EnumerationgetAllPropertyNames()return all property names, including standard JMS properties and JMSX propertiesbooleangetBooleanProperty(String name)bytegetByteProperty(String name)bytegetDataStructureType()doublegetDoubleProperty(String name)floatgetFloatProperty(String name)intgetIntProperty(String name)StringgetJMSCorrelationID()byte[]getJMSCorrelationIDAsBytes()intgetJMSDeliveryMode()DestinationgetJMSDestination()longgetJMSExpiration()StringgetJMSMessageID()intgetJMSPriority()booleangetJMSRedelivered()DestinationgetJMSReplyTo()longgetJMSTimestamp()StringgetJMSType()StringgetJMSXMimeType()Returns the MIME type of this mesage.longgetLongProperty(String name)ObjectgetObjectProperty(String name)EnumerationgetPropertyNames()shortgetShortProperty(String name)StringgetStringProperty(String name)inthashCode()protected booleanisContentMarshalled()voidonSend()Send operation event listener.booleanpropertyExists(String name)voidsetAcknowledgeCallback(Callback acknowledgeCallback)voidsetBooleanProperty(String name, boolean value)voidsetBooleanProperty(String name, boolean value, boolean checkReadOnly)voidsetByteProperty(String name, byte value)voidsetDoubleProperty(String name, double value)voidsetFloatProperty(String name, float value)voidsetIntProperty(String name, int value)voidsetJMSCorrelationID(String correlationId)voidsetJMSCorrelationIDAsBytes(byte[] correlationId)voidsetJMSDeliveryMode(int mode)voidsetJMSDestination(Destination destination)voidsetJMSExpiration(long expiration)voidsetJMSMessageID(String value)Seems to be invalid because the parameter doesn't initialize MessageId instance variables ProducerId and ProducerSequenceIdvoidsetJMSMessageID(ProducerId producerId, long producerSequenceId)This will create an object of MessageId.voidsetJMSPriority(int priority)voidsetJMSRedelivered(boolean redelivered)voidsetJMSReplyTo(Destination destination)voidsetJMSTimestamp(long timestamp)voidsetJMSType(String type)voidsetLongProperty(String name, long value)voidsetObjectProperty(String name, Object value)voidsetObjectProperty(String name, Object value, boolean checkReadOnly)voidsetProperties(Map<String,?> properties)voidsetShortProperty(String name, short value)voidsetStringProperty(String name, String value)voidstoreContent()voidstoreContentAndClear()Responsevisit(CommandVisitor visitor)-
Methods inherited from class org.apache.activemq.command.Message
afterMarshall, afterUnmarshall, beforeMarshall, beforeUnmarshall, canProcessAsExpired, clearUnMarshalledState, 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, isJMSXGroupFirstForConsumer, isMarshallAware, isMarshalled, isMessage, isPersistent, isPropertiesMarshalled, isReadOnlyBody, isReadOnlyProperties, isRecievedByDFBridge, isRedelivered, lazyCreateProperties, onMessageRolledBack, removeProperty, setArrival, setBrokerInTime, setBrokerOutTime, setBrokerPath, setCluster, setCompressed, setConnection, setContent, setCorrelationId, setDataStructure, setDestination, setDroppable, setExpiration, setGroupID, setGroupSequence, setJMSXGroupFirstForConsumer, 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, isConsumerControl, isMessageAck, isMessageDispatch, isMessageDispatchNotification, isResponse, isResponseRequired, isShutdownInfo, isWireFormatInfo, setCommandId, setFrom, setResponseRequired, setTo
-
-
-
-
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
-
BROKER_PATH_PROPERTY
public static final String BROKER_PATH_PROPERTY
- See Also:
- Constant Field Values
-
acknowledgeCallback
protected transient Callback acknowledgeCallback
-
-
Method Detail
-
getDataStructureType
public byte getDataStructureType()
- Specified by:
getDataStructureTypein interfaceDataStructure- Returns:
- The type of the data structure
-
copy
protected void copy(ActiveMQMessage copy)
-
acknowledge
public void acknowledge() throws JMSException- Specified by:
acknowledgein interfaceMessage- Throws:
JMSException
-
clearBody
public void clearBody() throws JMSException- Specified by:
clearBodyin interfaceMessage- Specified by:
clearBodyin classMessage- Throws:
JMSException
-
getJMSMessageID
public String getJMSMessageID()
- Specified by:
getJMSMessageIDin interfaceMessage
-
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:
setJMSMessageIDin interfaceMessage- 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:
getJMSTimestampin interfaceMessage
-
setJMSTimestamp
public void setJMSTimestamp(long timestamp)
- Specified by:
setJMSTimestampin interfaceMessage
-
getJMSCorrelationID
public String getJMSCorrelationID()
- Specified by:
getJMSCorrelationIDin interfaceMessage
-
setJMSCorrelationID
public void setJMSCorrelationID(String correlationId)
- Specified by:
setJMSCorrelationIDin interfaceMessage
-
getJMSCorrelationIDAsBytes
public byte[] getJMSCorrelationIDAsBytes() throws JMSException- Specified by:
getJMSCorrelationIDAsBytesin interfaceMessage- Throws:
JMSException
-
setJMSCorrelationIDAsBytes
public void setJMSCorrelationIDAsBytes(byte[] correlationId) throws JMSException- Specified by:
setJMSCorrelationIDAsBytesin interfaceMessage- Throws:
JMSException
-
getJMSXMimeType
public String getJMSXMimeType()
Description copied from interface:MessageReturns 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 ofBlobMessageit allows you to create a selector on the MIME type of the BLOB body- Specified by:
getJMSXMimeTypein interfaceMessage
-
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:
getJMSReplyToin interfaceMessage
-
setJMSReplyTo
public void setJMSReplyTo(Destination destination) throws JMSException
- Specified by:
setJMSReplyToin interfaceMessage- Throws:
JMSException
-
getJMSDestination
public Destination getJMSDestination()
- Specified by:
getJMSDestinationin interfaceMessage
-
setJMSDestination
public void setJMSDestination(Destination destination) throws JMSException
- Specified by:
setJMSDestinationin interfaceMessage- Throws:
JMSException
-
getJMSDeliveryMode
public int getJMSDeliveryMode()
- Specified by:
getJMSDeliveryModein interfaceMessage
-
setJMSDeliveryMode
public void setJMSDeliveryMode(int mode)
- Specified by:
setJMSDeliveryModein interfaceMessage
-
getJMSRedelivered
public boolean getJMSRedelivered()
- Specified by:
getJMSRedeliveredin interfaceMessage
-
setJMSRedelivered
public void setJMSRedelivered(boolean redelivered)
- Specified by:
setJMSRedeliveredin interfaceMessage
-
getJMSType
public String getJMSType()
- Specified by:
getJMSTypein interfaceMessage
-
setJMSType
public void setJMSType(String type)
- Specified by:
setJMSTypein interfaceMessage
-
getJMSExpiration
public long getJMSExpiration()
- Specified by:
getJMSExpirationin interfaceMessage
-
setJMSExpiration
public void setJMSExpiration(long expiration)
- Specified by:
setJMSExpirationin interfaceMessage
-
getJMSPriority
public int getJMSPriority()
- Specified by:
getJMSPriorityin interfaceMessage
-
setJMSPriority
public void setJMSPriority(int priority)
- Specified by:
setJMSPriorityin interfaceMessage
-
clearProperties
public void clearProperties()
- Specified by:
clearPropertiesin interfaceMessage- Overrides:
clearPropertiesin classMessage
-
propertyExists
public boolean propertyExists(String name) throws JMSException
- Specified by:
propertyExistsin interfaceMessage- Throws:
JMSException
-
getPropertyNames
public Enumeration getPropertyNames() throws JMSException
- Specified by:
getPropertyNamesin interfaceMessage- 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:
setObjectPropertyin interfaceMessage- 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
-
convertScheduled
protected Object convertScheduled(String name, Object value) throws MessageFormatException
- Throws:
MessageFormatException
-
getObjectProperty
public Object getObjectProperty(String name) throws JMSException
- Specified by:
getObjectPropertyin interfaceMessage- Throws:
JMSException
-
getBooleanProperty
public boolean getBooleanProperty(String name) throws JMSException
- Specified by:
getBooleanPropertyin interfaceMessage- Throws:
JMSException
-
getByteProperty
public byte getByteProperty(String name) throws JMSException
- Specified by:
getBytePropertyin interfaceMessage- Throws:
JMSException
-
getShortProperty
public short getShortProperty(String name) throws JMSException
- Specified by:
getShortPropertyin interfaceMessage- Throws:
JMSException
-
getIntProperty
public int getIntProperty(String name) throws JMSException
- Specified by:
getIntPropertyin interfaceMessage- Throws:
JMSException
-
getLongProperty
public long getLongProperty(String name) throws JMSException
- Specified by:
getLongPropertyin interfaceMessage- Throws:
JMSException
-
getFloatProperty
public float getFloatProperty(String name) throws JMSException
- Specified by:
getFloatPropertyin interfaceMessage- Throws:
JMSException
-
getDoubleProperty
public double getDoubleProperty(String name) throws JMSException
- Specified by:
getDoublePropertyin interfaceMessage- Throws:
JMSException
-
getStringProperty
public String getStringProperty(String name) throws JMSException
- Specified by:
getStringPropertyin interfaceMessage- Throws:
JMSException
-
setBooleanProperty
public void setBooleanProperty(String name, boolean value) throws JMSException
- Specified by:
setBooleanPropertyin interfaceMessage- 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:
setBytePropertyin interfaceMessage- Throws:
JMSException
-
setShortProperty
public void setShortProperty(String name, short value) throws JMSException
- Specified by:
setShortPropertyin interfaceMessage- Throws:
JMSException
-
setIntProperty
public void setIntProperty(String name, int value) throws JMSException
- Specified by:
setIntPropertyin interfaceMessage- Throws:
JMSException
-
setLongProperty
public void setLongProperty(String name, long value) throws JMSException
- Specified by:
setLongPropertyin interfaceMessage- Throws:
JMSException
-
setFloatProperty
public void setFloatProperty(String name, float value) throws JMSException
- Specified by:
setFloatPropertyin interfaceMessage- Throws:
JMSException
-
setDoubleProperty
public void setDoubleProperty(String name, double value) throws JMSException
- Specified by:
setDoublePropertyin interfaceMessage- Throws:
JMSException
-
setStringProperty
public void setStringProperty(String name, String value) throws JMSException
- Specified by:
setStringPropertyin interfaceMessage- Throws:
JMSException
-
checkReadOnlyProperties
protected void checkReadOnlyProperties() throws MessageNotWriteableException- Throws:
MessageNotWriteableException
-
checkReadOnlyBody
protected void checkReadOnlyBody() throws MessageNotWriteableException- Throws:
MessageNotWriteableException
-
getAcknowledgeCallback
public Callback getAcknowledgeCallback()
-
setAcknowledgeCallback
public void setAcknowledgeCallback(Callback acknowledgeCallback)
-
onSend
public void onSend() throws JMSExceptionSend operation event listener. Used to get the message ready to be sent.- Throws:
JMSException
-
visit
public Response visit(CommandVisitor visitor) throws Exception
-
storeContent
public void storeContent()
- Specified by:
storeContentin classMessage
-
storeContentAndClear
public void storeContentAndClear()
- Specified by:
storeContentAndClearin classMessage
-
isContentMarshalled
protected boolean isContentMarshalled()
- Overrides:
isContentMarshalledin classMessage
-
-