public final class Message extends Object implements Comparable<Message>, Serializable, Encodable, MessageView
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.
Modifier and Type | Class and Description |
---|---|
static class |
Message.MessageFactory |
Modifier and Type | Field and Description |
---|---|
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).
|
private SoftReference |
bodySoftRef
SoftReference to the body of the MOM message.
|
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).
|
private static boolean |
globalUseSoftRef
Defines if the swapping mechanism is globally activated for messages
in this server.
|
static Logger |
logger
logger
|
private Message |
msg
Reference to the MOM message.
|
long |
order
Arrival position of this message on its queue or proxy.
|
private static long |
serialVersionUID
define serialVersionUID for interoperability
|
private boolean |
soft
true if soft reference is used for the message. |
(package private) String |
txname
Name used to store the message
|
private static boolean |
useLoadALL
Defines if the queue restoration at startup must use the loadAll transaction
mechanism when it is implemented.
|
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
Constructor and Description |
---|
Message()
Empty constructor.
|
Message(Message msg)
Constructs a
Message instance. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Message msg) |
void |
decode(Decoder decoder)
Decodes the content of this object
|
void |
delete() |
static void |
deleteAll(String msgTxname)
Deletes all persisted objects.
|
void |
encode(Encoder encoder)
Encodes the content of this object
|
int |
getAcksCounter() |
String |
getClientID()
Get the clientID
|
String |
getCorrelationId()
Returns the message correlation identifier.
|
int |
getDeliveryCount()
Returns the message delivery count.
|
long |
getDeliveryTime()
Returns the message delivery time
|
int |
getDurableAcksCounter() |
int |
getEncodableClassId()
Returns a unique class identifier.
|
int |
getEncodedSize()
Returns the size of the byte array that results from the encoding of this object.
|
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.
|
String |
getId()
Returns the message identifier.
|
Message |
getMsg() |
long |
getOrder() |
int |
getPriority()
Returns the message priority.
|
Map |
getProperties() |
String |
getText() |
long |
getTimestamp()
Returns the message time stamp.
|
String |
getTxName() |
int |
getType()
Returns the message type.
|
boolean |
hasExpiration()
Return true if the message has an expiration delay.
|
void |
incAcksCounter() |
void |
incDeliveryCount()
Increments the message delivery count.
|
void |
incDurableAcksCounter() |
boolean |
isPersistent()
Returns
true if the message is persistent. |
boolean |
isRedelivered() |
boolean |
isValid(long currentTime)
Returns
true if the message is valid. |
static Message |
load(String txname) |
static Vector<Message> |
loadAll(String msgTxname,
int max)
Loads all persisted messages.
|
private void |
readObject(ObjectInputStream in) |
void |
releaseFullMessage()
Creates a soft reference instead of a hard one linking to the body of the
contained message.
|
void |
save()
Method used to save the initial state of the message.
|
void |
saveHeader()
Method used to save the header of a message after modification.
|
void |
setCorrelationId(String correlationId)
Sets the message correlation identifier.
|
void |
setDeliveryCount(int deliveryCount)
Sets the message delivery count.
|
void |
setDeliveryTime(long deliveryTime)
Sets the message delivery time
|
void |
setExpiration(long expiration)
Sets the message expiration.
|
void |
setIdentifier(String id)
Sets the message identifier.
|
void |
setObjectProperty(String name,
Object value)
Sets a property value.
|
void |
setOrder(long order) |
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(String txname) |
private void |
writeObject(ObjectOutputStream out) |
private static final long serialVersionUID
public static Logger logger
public transient long order
public transient int acksCounter
public transient int durableAcksCounter
private transient Message msg
private static final boolean useLoadALL
Default value is false.
This property can be fixed either from java
launching
command, or in a3servers.xml
configuration file.
private transient SoftReference bodySoftRef
private transient boolean soft
true
if soft reference is used for the message.private static final boolean globalUseSoftRef
Default value is false.
Note: the message swapping can be finely configured using the
JMS_JORAM_SWAPALLOWED
property of the JMS message.
This property can be fixed either from java
launching
command, or in a3servers.xml
configuration file.
transient String txname
public Message()
public Message(Message msg)
Message
instance.public int compareTo(Message msg)
compareTo
in interface Comparable<Message>
public final Message getMsg()
public Message getHeaderMessage()
public Message getFullMessage()
public void releaseFullMessage()
public int getType()
getType
in interface MessageView
public String getId()
getId
in interface MessageView
public void setIdentifier(String id)
public boolean isPersistent()
true
if the message is persistent.isPersistent
in interface MessageView
public void setPersistent(boolean persistent)
public int getPriority()
getPriority
in interface MessageView
public void setPriority(int priority)
priority
- Priority value: 0 the lowest, 9 the highest, 4 normal.public long getExpiration()
getExpiration
in interface MessageView
public void setExpiration(long expiration)
expiration
- The expiration time.public long getTimestamp()
getTimestamp
in interface MessageView
public void setTimestamp(long timestamp)
public final String getCorrelationId()
public void setCorrelationId(String correlationId)
public int getDeliveryCount()
getDeliveryCount
in interface MessageView
public void setDeliveryCount(int deliveryCount)
public void incDeliveryCount()
public void setRedelivered()
public void setDeliveryTime(long deliveryTime)
public long getDeliveryTime()
public long getOrder()
public void setOrder(long order)
public int getAcksCounter()
public void incAcksCounter()
public int getDurableAcksCounter()
public void incDurableAcksCounter()
public String getClientID()
public void setObjectProperty(String name, Object value)
name
- The property name.value
- The property value.public boolean isValid(long currentTime)
true
if the message is valid.
The message is valid if not expired.currentTime
- The current time to verify the expiration time.public final boolean hasExpiration()
public void setTxName(String txname)
public String getTxName()
public static Message load(String txname) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public void save()
public void saveHeader()
public void delete()
public static Vector<Message> loadAll(String msgTxname, int max)
msgTxname
- prefix of messages to load.max
- the maximum number of messages to loadpublic static void deleteAll(String msgTxname)
private void writeObject(ObjectOutputStream out) throws IOException
IOException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
ClassNotFoundException
IOException
public String getText()
getText
in interface MessageView
public boolean isRedelivered()
isRedelivered
in interface MessageView
public Map getProperties()
getProperties
in interface MessageView
public int getEncodableClassId()
Encodable
getEncodableClassId
in interface Encodable
public int getEncodedSize() throws Exception
Encodable
getEncodedSize
in interface Encodable
Exception
- if an error occurspublic void encode(Encoder encoder) throws Exception
Encodable
Copyright © 2022 ScalAgent D.T.. All rights reserved.