org.apache.activemq.command
Class Message

java.lang.Object
  extended by org.apache.activemq.command.BaseCommand
      extended by org.apache.activemq.command.Message
All Implemented Interfaces:
MessageReference, Command, DataStructure, MarshallAware
Direct Known Subclasses:
ActiveMQMessage

public abstract class Message
extends BaseCommand
implements MarshallAware, MessageReference

Represents an ActiveMQ message


Nested Class Summary
static interface Message.MessageDestination
           
 
Field Summary
protected  long arrival
           
protected  long brokerInTime
           
protected  long brokerOutTime
           
protected  boolean compressed
           
protected  ByteSequence content
           
protected  String correlationId
           
protected  DataStructure dataStructure
           
static int DEFAULT_MINIMUM_MESSAGE_SIZE
          The default minimum amount of memory a message is assumed to use
protected  ActiveMQDestination destination
           
protected  boolean droppable
           
protected  long expiration
           
protected  String groupID
           
protected  int groupSequence
           
protected  boolean jmsXGroupFirstForConsumer
           
protected  ByteSequence marshalledProperties
           
protected  MessageId messageId
           
static String ORIGINAL_EXPIRATION
           
protected  ActiveMQDestination originalDestination
           
protected  TransactionId originalTransactionId
           
protected  boolean persistent
           
protected  byte priority
           
protected  ProducerId producerId
           
protected  Map<String,Object> properties
           
protected  boolean readOnlyBody
           
protected  boolean readOnlyProperties
           
protected  boolean recievedByDFBridge
           
protected  int redeliveryCounter
           
protected  ActiveMQDestination replyTo
           
protected  int size
           
protected  ConsumerId targetConsumerId
           
protected  long timestamp
           
protected  TransactionId transactionId
           
protected  String type
           
protected  String userID
           
 
Fields inherited from class org.apache.activemq.command.BaseCommand
commandId, responseRequired
 
Constructor Summary
Message()
           
 
Method Summary
 void afterMarshall(WireFormat wireFormat)
           
 void afterUnmarshall(WireFormat wireFormat)
           
 void beforeMarshall(WireFormat wireFormat)
           
 void beforeUnmarshall(WireFormat wireFormat)
           
abstract  void clearBody()
           
 void clearMarshalledState()
           
 void clearProperties()
           
 void compress()
           
abstract  Message copy()
           
protected  void copy(Message copy)
           
 int decrementReferenceCount()
           
protected  void doCompress()
           
 long getArrival()
          Used to schedule the arrival time of a message to a broker.
 long getBrokerInTime()
           
 long getBrokerOutTime()
           
 BrokerId[] getBrokerPath()
          The route of brokers the command has moved through.
 BrokerId[] getCluster()
          If a message is stored in multiple nodes on a cluster, all the cluster members will be listed here.
 ActiveMQConnection getConnection()
           
 ByteSequence getContent()
           
 String getCorrelationId()
           
 DataStructure getDataStructure()
           
 ActiveMQDestination getDestination()
           
 long getExpiration()
           
 String getGroupID()
           
 int getGroupSequence()
           
 ByteSequence getMarshalledProperties()
           
 MemoryUsage getMemoryUsage()
           
 Message getMessage()
           
 Message getMessageHardRef()
           
 MessageId getMessageId()
           
protected  int getMinimumMessageSize()
           
 ActiveMQDestination getOriginalDestination()
           
 TransactionId getOriginalTransactionId()
           
 byte getPriority()
           
 ProducerId getProducerId()
           
 Map<String,Object> getProperties()
           
 Object getProperty(String name)
           
 int getRedeliveryCounter()
           
 int getReferenceCount()
           
 Message.MessageDestination getRegionDestination()
           
 ActiveMQDestination getReplyTo()
           
 int getSize()
           
 ConsumerId getTargetConsumerId()
          Can be used to route the message to a specific consumer.
 long getTimestamp()
           
 TransactionId getTransactionId()
           
 String getType()
           
 String getUserID()
          Only set by the broker and defines the userID of the producer connection who sent this message.
 void incrementRedeliveryCounter()
           
 int incrementReferenceCount()
           
 boolean isAdvisory()
           
 boolean isCompressed()
           
 boolean isDroppable()
           
 boolean isDropped()
          Returns true if this message is dropped.
 boolean isExpired()
          Returns true if this message is expired
 boolean isInTransaction()
           
 boolean isJMSXGroupFirstForConsumer()
           
 boolean isMarshallAware()
           
 boolean isMessage()
           
 boolean isPersistent()
           
 boolean isReadOnlyBody()
           
 boolean isReadOnlyProperties()
           
 boolean isRecievedByDFBridge()
           
 boolean isRedelivered()
           
protected  void lazyCreateProperties()
           
 void onMessageRolledBack()
           
 void removeProperty(String name)
           
 void setArrival(long arrival)
           
 void setBrokerInTime(long brokerInTime)
           
 void setBrokerOutTime(long brokerOutTime)
           
 void setBrokerPath(BrokerId[] brokerPath)
           
 void setCluster(BrokerId[] cluster)
           
 void setCompressed(boolean compressed)
           
 void setConnection(ActiveMQConnection connection)
           
 void setContent(ByteSequence content)
           
 void setCorrelationId(String correlationId)
           
 void setDataStructure(DataStructure data)
           
 void setDestination(ActiveMQDestination destination)
           
 void setDroppable(boolean droppable)
           
 void setExpiration(long expiration)
           
 void setGroupID(String groupID)
           
 void setGroupSequence(int groupSequence)
           
 void setJMSXGroupFirstForConsumer(boolean val)
           
 void setMarshalledProperties(ByteSequence marshalledProperties)
           
 void setMemoryUsage(MemoryUsage usage)
           
 void setMessageId(MessageId messageId)
           
 void setOriginalDestination(ActiveMQDestination destination)
           
 void setOriginalTransactionId(TransactionId transactionId)
           
 void setPersistent(boolean deliveryMode)
           
 void setPriority(byte priority)
           
 void setProducerId(ProducerId producerId)
           
 void setProperty(String name, Object value)
           
 void setReadOnlyBody(boolean readOnlyBody)
           
 void setReadOnlyProperties(boolean readOnlyProperties)
           
 void setRecievedByDFBridge(boolean recievedByDFBridge)
           
 void setRedelivered(boolean redelivered)
           
 void setRedeliveryCounter(int deliveryCounter)
           
 void setRegionDestination(Message.MessageDestination destination)
           
 void setReplyTo(ActiveMQDestination replyTo)
           
 void setTargetConsumerId(ConsumerId targetConsumerId)
           
 void setTimestamp(long timestamp)
           
 void setTransactionId(TransactionId transactionId)
           
 void setType(String type)
           
 void setUserID(String jmsxUserID)
           
abstract  void storeContent()
           
abstract  void storeContentAndClear()
           
 String toString()
           
 String toString(Map<String,Object> overrideFields)
           
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.command.Command
visit
 
Methods inherited from interface org.apache.activemq.command.DataStructure
getDataStructureType
 

Field Detail

ORIGINAL_EXPIRATION

public static final String ORIGINAL_EXPIRATION
See Also:
Constant Field Values

DEFAULT_MINIMUM_MESSAGE_SIZE

public static final int DEFAULT_MINIMUM_MESSAGE_SIZE
The default minimum amount of memory a message is assumed to use

See Also:
Constant Field Values

messageId

protected MessageId messageId

originalDestination

protected ActiveMQDestination originalDestination

originalTransactionId

protected TransactionId originalTransactionId

producerId

protected ProducerId producerId

destination

protected ActiveMQDestination destination

transactionId

protected TransactionId transactionId

expiration

protected long expiration

timestamp

protected long timestamp

arrival

protected long arrival

brokerInTime

protected long brokerInTime

brokerOutTime

protected long brokerOutTime

correlationId

protected String correlationId

replyTo

protected ActiveMQDestination replyTo

persistent

protected boolean persistent

type

protected String type

priority

protected byte priority

groupID

protected String groupID

groupSequence

protected int groupSequence

targetConsumerId

protected ConsumerId targetConsumerId

compressed

protected boolean compressed

userID

protected String userID

content

protected ByteSequence content

marshalledProperties

protected ByteSequence marshalledProperties

dataStructure

protected DataStructure dataStructure

redeliveryCounter

protected int redeliveryCounter

size

protected int size

properties

protected Map<String,Object> properties

readOnlyProperties

protected boolean readOnlyProperties

readOnlyBody

protected boolean readOnlyBody

recievedByDFBridge

protected transient boolean recievedByDFBridge

droppable

protected boolean droppable

jmsXGroupFirstForConsumer

protected boolean jmsXGroupFirstForConsumer
Constructor Detail

Message

public Message()
Method Detail

copy

public abstract Message copy()

clearBody

public abstract void clearBody()
                        throws JMSException
Throws:
JMSException

storeContent

public abstract void storeContent()

storeContentAndClear

public abstract void storeContentAndClear()

clearMarshalledState

public void clearMarshalledState()
                          throws JMSException
Throws:
JMSException

copy

protected void copy(Message copy)

getProperty

public Object getProperty(String name)
                   throws IOException
Throws:
IOException

getProperties

public Map<String,Object> getProperties()
                                 throws IOException
Throws:
IOException

clearProperties

public void clearProperties()

setProperty

public void setProperty(String name,
                        Object value)
                 throws IOException
Throws:
IOException

removeProperty

public void removeProperty(String name)
                    throws IOException
Throws:
IOException

lazyCreateProperties

protected void lazyCreateProperties()
                             throws IOException
Throws:
IOException

beforeMarshall

public void beforeMarshall(WireFormat wireFormat)
                    throws IOException
Specified by:
beforeMarshall in interface MarshallAware
Throws:
IOException

afterMarshall

public void afterMarshall(WireFormat wireFormat)
                   throws IOException
Specified by:
afterMarshall in interface MarshallAware
Throws:
IOException

beforeUnmarshall

public void beforeUnmarshall(WireFormat wireFormat)
                      throws IOException
Specified by:
beforeUnmarshall in interface MarshallAware
Throws:
IOException

afterUnmarshall

public void afterUnmarshall(WireFormat wireFormat)
                     throws IOException
Specified by:
afterUnmarshall in interface MarshallAware
Throws:
IOException

getProducerId

public ProducerId getProducerId()

setProducerId

public void setProducerId(ProducerId producerId)

getDestination

public ActiveMQDestination getDestination()

setDestination

public void setDestination(ActiveMQDestination destination)

getTransactionId

public TransactionId getTransactionId()

setTransactionId

public void setTransactionId(TransactionId transactionId)

isInTransaction

public boolean isInTransaction()

getOriginalDestination

public ActiveMQDestination getOriginalDestination()

setOriginalDestination

public void setOriginalDestination(ActiveMQDestination destination)

getMessageId

public MessageId getMessageId()
Specified by:
getMessageId in interface MessageReference

setMessageId

public void setMessageId(MessageId messageId)

getOriginalTransactionId

public TransactionId getOriginalTransactionId()

setOriginalTransactionId

public void setOriginalTransactionId(TransactionId transactionId)

getGroupID

public String getGroupID()
Specified by:
getGroupID in interface MessageReference

setGroupID

public void setGroupID(String groupID)

getGroupSequence

public int getGroupSequence()
Specified by:
getGroupSequence in interface MessageReference

setGroupSequence

public void setGroupSequence(int groupSequence)

getCorrelationId

public String getCorrelationId()

setCorrelationId

public void setCorrelationId(String correlationId)

isPersistent

public boolean isPersistent()
Specified by:
isPersistent in interface MessageReference

setPersistent

public void setPersistent(boolean deliveryMode)

getExpiration

public long getExpiration()
Specified by:
getExpiration in interface MessageReference

setExpiration

public void setExpiration(long expiration)

getPriority

public byte getPriority()

setPriority

public void setPriority(byte priority)

getReplyTo

public ActiveMQDestination getReplyTo()

setReplyTo

public void setReplyTo(ActiveMQDestination replyTo)

getTimestamp

public long getTimestamp()

setTimestamp

public void setTimestamp(long timestamp)

getType

public String getType()

setType

public void setType(String type)

getContent

public ByteSequence getContent()

setContent

public void setContent(ByteSequence content)

getMarshalledProperties

public ByteSequence getMarshalledProperties()

setMarshalledProperties

public void setMarshalledProperties(ByteSequence marshalledProperties)

getDataStructure

public DataStructure getDataStructure()

setDataStructure

public void setDataStructure(DataStructure data)

getTargetConsumerId

public ConsumerId getTargetConsumerId()
Can be used to route the message to a specific consumer. Should be null to allow the broker use normal JMS routing semantics. If the target consumer id is an active consumer on the broker, the message is dropped. Used by the AdvisoryBroker to replay advisory messages to a specific consumer.

Specified by:
getTargetConsumerId in interface MessageReference

setTargetConsumerId

public void setTargetConsumerId(ConsumerId targetConsumerId)

isExpired

public boolean isExpired()
Description copied from interface: MessageReference
Returns true if this message is expired

Specified by:
isExpired in interface MessageReference

isAdvisory

public boolean isAdvisory()
Specified by:
isAdvisory in interface MessageReference
Returns:
true if the message is an advisory

isCompressed

public boolean isCompressed()

setCompressed

public void setCompressed(boolean compressed)

isRedelivered

public boolean isRedelivered()

setRedelivered

public void setRedelivered(boolean redelivered)

incrementRedeliveryCounter

public void incrementRedeliveryCounter()
Specified by:
incrementRedeliveryCounter in interface MessageReference

getRedeliveryCounter

public int getRedeliveryCounter()
Specified by:
getRedeliveryCounter in interface MessageReference

setRedeliveryCounter

public void setRedeliveryCounter(int deliveryCounter)

getBrokerPath

public BrokerId[] getBrokerPath()
The route of brokers the command has moved through.


setBrokerPath

public void setBrokerPath(BrokerId[] brokerPath)

isReadOnlyProperties

public boolean isReadOnlyProperties()

setReadOnlyProperties

public void setReadOnlyProperties(boolean readOnlyProperties)

isReadOnlyBody

public boolean isReadOnlyBody()

setReadOnlyBody

public void setReadOnlyBody(boolean readOnlyBody)

getConnection

public ActiveMQConnection getConnection()

setConnection

public void setConnection(ActiveMQConnection connection)

getArrival

public long getArrival()
Used to schedule the arrival time of a message to a broker. The broker will not dispatch a message to a consumer until it's arrival time has elapsed.


setArrival

public void setArrival(long arrival)

getUserID

public String getUserID()
Only set by the broker and defines the userID of the producer connection who sent this message. This is an optional field, it needs to be enabled on the broker to have this field populated.


setUserID

public void setUserID(String jmsxUserID)

getReferenceCount

public int getReferenceCount()
Specified by:
getReferenceCount in interface MessageReference

getMessageHardRef

public Message getMessageHardRef()
Specified by:
getMessageHardRef in interface MessageReference

getMessage

public Message getMessage()
Specified by:
getMessage in interface MessageReference

setRegionDestination

public void setRegionDestination(Message.MessageDestination destination)

getRegionDestination

public Message.MessageDestination getRegionDestination()
Specified by:
getRegionDestination in interface MessageReference

getMemoryUsage

public MemoryUsage getMemoryUsage()

setMemoryUsage

public void setMemoryUsage(MemoryUsage usage)

isMarshallAware

public boolean isMarshallAware()
Specified by:
isMarshallAware in interface DataStructure
Overrides:
isMarshallAware in class BaseCommand

incrementReferenceCount

public int incrementReferenceCount()
Specified by:
incrementReferenceCount in interface MessageReference

decrementReferenceCount

public int decrementReferenceCount()
Specified by:
decrementReferenceCount in interface MessageReference

getSize

public int getSize()
Specified by:
getSize in interface MessageReference

getMinimumMessageSize

protected int getMinimumMessageSize()

isRecievedByDFBridge

public boolean isRecievedByDFBridge()
Returns:
Returns the recievedByDFBridge.

setRecievedByDFBridge

public void setRecievedByDFBridge(boolean recievedByDFBridge)
Parameters:
recievedByDFBridge - The recievedByDFBridge to set.

onMessageRolledBack

public void onMessageRolledBack()

isDroppable

public boolean isDroppable()

setDroppable

public void setDroppable(boolean droppable)

getCluster

public BrokerId[] getCluster()
If a message is stored in multiple nodes on a cluster, all the cluster members will be listed here. Otherwise, it will be null.


setCluster

public void setCluster(BrokerId[] cluster)

isMessage

public boolean isMessage()
Specified by:
isMessage in interface Command
Overrides:
isMessage in class BaseCommand

getBrokerInTime

public long getBrokerInTime()

setBrokerInTime

public void setBrokerInTime(long brokerInTime)

getBrokerOutTime

public long getBrokerOutTime()

setBrokerOutTime

public void setBrokerOutTime(long brokerOutTime)

isDropped

public boolean isDropped()
Description copied from interface: MessageReference
Returns true if this message is dropped.

Specified by:
isDropped in interface MessageReference

isJMSXGroupFirstForConsumer

public boolean isJMSXGroupFirstForConsumer()

setJMSXGroupFirstForConsumer

public void setJMSXGroupFirstForConsumer(boolean val)

compress

public void compress()
              throws IOException
Throws:
IOException

doCompress

protected void doCompress()
                   throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class BaseCommand

toString

public String toString(Map<String,Object> overrideFields)
Overrides:
toString in class BaseCommand


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.