org.jboss.messaging.core.contract
Interface Message

All Superinterfaces:
Streamable
All Known Implementing Classes:
CoreMessage, JBossBytesMessage, JBossMapMessage, JBossMessage, JBossObjectMessage, JBossStreamMessage, JBossTextMessage, MessageSupport

public interface Message
extends Streamable

A message is a routable instance that has a payload. The payload is opaque to the messaging system.

Version:
$Revision: 3031 $ $Id: Message.java 3031 2007-08-22 19:18:40Z timfox $
Author:
Ovidiu Feodorov, Tim Fox

Field Summary
static java.lang.String CLUSTER_SUCKED
          This header is set on a message when a message is sucked from one node of the cluster to another and order preservation is true.
 
Method Summary
 boolean containsHeader(java.lang.String name)
          Returns true if the Routable contains the specified header.
 MessageReference createReference()
           
 long getExpiration()
           
 java.lang.Object getHeader(java.lang.String name)
          Returns the value corresponding to the header name.
 java.util.Map getHeaders()
           
 long getMessageID()
           
 java.lang.Object getPayload()
           
 byte[] getPayloadAsByteArray()
           
 byte getPriority()
           
 long getTimestamp()
           
 byte getType()
           
 boolean isExpired()
           
 boolean isPersisted()
           
 boolean isReliable()
           
 java.lang.Object putHeader(java.lang.String name, java.lang.Object value)
          Binds a header.
 java.lang.Object removeHeader(java.lang.String name)
          Removes the header.
 void setExpiration(long expiration)
          Set the expiration for this message
 void setPersisted(boolean persisted)
           
 void setPriority(byte priority)
          Get the priority of the message.
 
Methods inherited from interface org.jboss.messaging.util.Streamable
read, write
 

Field Detail

CLUSTER_SUCKED

static final java.lang.String CLUSTER_SUCKED
This header is set on a message when a message is sucked from one node of the cluster to another and order preservation is true. The header is checked when sucking messages and if order preservation is true then the message is not accepted. This is a basic way of ensuring message order is preserved.

See Also:
Constant Field Values
Method Detail

getMessageID

long getMessageID()
Returns:
The unique id of the message

isReliable

boolean isReliable()
Returns:
true if the delivery must be guaranteed for this routable, false otherwise.

getExpiration

long getExpiration()
Returns:
the time when this routable expires and must be removed from the system. A zero value means this routable never expires.

isExpired

boolean isExpired()
Returns:
true if the message has expired

setExpiration

void setExpiration(long expiration)
Set the expiration for this message

Parameters:
expiration -

getTimestamp

long getTimestamp()
Returns:
the time (in GMT milliseconds) when this routable was delivered to the provider.

getPriority

byte getPriority()

setPriority

void setPriority(byte priority)
Get the priority of the message. Priorities range from 0 to 9. Where 0 is the lowest priority and 9 is the highest priority

Parameters:
priority -

putHeader

java.lang.Object putHeader(java.lang.String name,
                           java.lang.Object value)
Binds a header. If the header map previously contained a mapping for this name, the old value is replaced by the specified value.

Returns:
the value associated with the name or null if there is no mapping for the name. A null can also indicate that the header map previously associated null with the specified name.

getHeader

java.lang.Object getHeader(java.lang.String name)
Returns the value corresponding to the header name. Returns null if the map contains no mapping for the name. A return value of null does not necessarily indicate that the map contains no mapping for the name; it's also possible that the map explicitly maps the name to null. The containsHeader() operation may be used to distinguish these two cases.

Returns:
the value associated with the header, or null if there is no mapping for the header.

removeHeader

java.lang.Object removeHeader(java.lang.String name)
Removes the header.

Returns:
previous value associated with the header, or null if there was no mapping.

containsHeader

boolean containsHeader(java.lang.String name)
Returns true if the Routable contains the specified header.


getHeaders

java.util.Map getHeaders()
Returns:
The message's headers

getPayload

java.lang.Object getPayload()
Returns:
The message's payload

getPayloadAsByteArray

byte[] getPayloadAsByteArray()
Returns:
The message's payload in byte[] form

getType

byte getType()
Returns:
the type of the message

createReference

MessageReference createReference()

isPersisted

boolean isPersisted()

setPersisted

void setPersisted(boolean persisted)


Copyright © 2006 JBoss Inc. All Rights Reserved.