Joram 5.2.6

org.objectweb.joram.mom.messages
Class Message

java.lang.Object
  extended by org.objectweb.joram.mom.messages.Message
All Implemented Interfaces:
java.io.Serializable

public final class Message
extends java.lang.Object
implements java.io.Serializable

The Message class actually provides the transport facility for the data exchanged during MOM operations.

A message content is always wrapped as a bytes array, it is characterized by properties and "header" fields.

See Also:
Serialized Form

Field Summary
 int acksCounter
          The number of acknowledgements a message still expects from its subscribers before having been fully consumed by them (field used by JMS proxies).
 int durableAcksCounter
          The number of acknowledgements a message still expects from its durable subscribers before having been fully consumed by them (field used by JMS proxies).
static org.objectweb.util.monolog.api.Logger logger
          logger
 long order
          Arrival position of this message on its queue or proxy.
 
Constructor Summary
Message(Message msg)
          Constructs a Message instance.
 
Method Summary
 void delete()
           
static void deleteAll(java.lang.String msgTxname)
          Deletes all persisted objects.
 java.lang.String getCorrelationId()
          Returns the message correlation identifier.
 int getDeliveryCount()
          Returns the message delivery count.
 long getExpiration()
          Returns the message expiration time.
 Message getFullMessage()
          Returns the contained message with body.
 Message getHeaderMessage()
          Returns the contained message eventually without the body.
 java.lang.String getIdentifier()
          Returns the message identifier.
 int getPriority()
          Returns the message priority.
 long getTimestamp()
          Returns the message time stamp.
 java.lang.String getTxName()
           
 int getType()
          Returns the message type.
 void incDeliveryCount()
          Increments the message delivery count.
 boolean isPersistent()
          Returns true if the message is persistent.
 boolean isValid(long currentTime)
          Returns true if the message is valid.
static Message load(java.lang.String txname)
           
static java.util.Vector loadAll(java.lang.String msgTxname)
          Loads all persisted messages.
 void releaseFullMessage()
          Creates a soft reference instead of a hard one linking to the body of the contained message.
 void save()
           
 void saveHeader()
           
 void setCorrelationId(java.lang.String correlationId)
          Sets the message correlation identifier.
 void setDeliveryCount(int deliveryCount)
          Sets the message delivery count.
 void setExpiration(long expiration)
          Sets the message expiration.
 void setIdentifier(java.lang.String id)
          Sets the message identifier.
 void setObjectProperty(java.lang.String name, java.lang.Object value)
          Sets a property value.
 void setPersistent(boolean persistent)
          Sets the message persistence mode.
 void setPriority(int priority)
          Sets the message priority.
 void setRedelivered()
          Sets the message redelivered flag.
 void setTimestamp(long timestamp)
          Sets the message time stamp.
 void setTxName(java.lang.String txname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.objectweb.util.monolog.api.Logger logger
logger


order

public transient long order
Arrival position of this message on its queue or proxy.


acksCounter

public transient int acksCounter
The number of acknowledgements a message still expects from its subscribers before having been fully consumed by them (field used by JMS proxies). Be careful, this field is not saved but set to 0 during message loading then calculated during the proxy initialization.


durableAcksCounter

public transient int durableAcksCounter
The number of acknowledgements a message still expects from its durable subscribers before having been fully consumed by them (field used by JMS proxies). Be careful, this field is not saved but set to 0 during message loading then calculated during the proxy initialization.

Constructor Detail

Message

public Message(Message msg)
Constructs a Message instance.

Method Detail

getHeaderMessage

public Message getHeaderMessage()
Returns the contained message eventually without the body.

Returns:
The contained message.

getFullMessage

public Message getFullMessage()
Returns the contained message with body. If needed the body is loaded from repository.

Returns:
The contained message.

releaseFullMessage

public void releaseFullMessage()
Creates a soft reference instead of a hard one linking to the body of the contained message. The message must have been saved previously.


getType

public int getType()
Returns the message type.


getIdentifier

public java.lang.String getIdentifier()
Returns the message identifier.


setIdentifier

public void setIdentifier(java.lang.String id)
Sets the message identifier.


isPersistent

public boolean isPersistent()
Returns true if the message is persistent.


setPersistent

public void setPersistent(boolean persistent)
Sets the message persistence mode.


getPriority

public int getPriority()
Returns the message priority.


setPriority

public void setPriority(int priority)
Sets the message priority.

Parameters:
priority - Priority value: 0 the lowest, 9 the highest, 4 normal.

getExpiration

public long getExpiration()
Returns the message expiration time.


setExpiration

public void setExpiration(long expiration)
Sets the message expiration.

Parameters:
expiration - The expiration time.

getTimestamp

public long getTimestamp()
Returns the message time stamp.


setTimestamp

public void setTimestamp(long timestamp)
Sets the message time stamp.


getCorrelationId

public final java.lang.String getCorrelationId()
Returns the message correlation identifier.


setCorrelationId

public void setCorrelationId(java.lang.String correlationId)
Sets the message correlation identifier.


getDeliveryCount

public int getDeliveryCount()
Returns the message delivery count.


setDeliveryCount

public void setDeliveryCount(int deliveryCount)
Sets the message delivery count.


incDeliveryCount

public void incDeliveryCount()
Increments the message delivery count.


setRedelivered

public void setRedelivered()
Sets the message redelivered flag.


setObjectProperty

public void setObjectProperty(java.lang.String name,
                              java.lang.Object value)
                       throws MessageException
Sets a property value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.
MessageValueException - If the value is not a Java primitive object.
java.lang.IllegalArgumentException - If the key name is illegal (null or empty string).
MessageException

isValid

public boolean isValid(long currentTime)
Returns true if the message is valid. The message is valid if not expired.

Parameters:
currentTime - The current time to verify the expiration time.

setTxName

public void setTxName(java.lang.String txname)

getTxName

public java.lang.String getTxName()

load

public static Message load(java.lang.String txname)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

save

public void save()

saveHeader

public void saveHeader()

delete

public void delete()

loadAll

public static java.util.Vector loadAll(java.lang.String msgTxname)
Loads all persisted messages.


deleteAll

public static void deleteAll(java.lang.String msgTxname)
Deletes all persisted objects.


Joram 5.2.6

Copyright © 2000 - 2009 Scalagent D.T. - All rights reserved