org.jboss.messaging.core.message
Interface Message

All Superinterfaces:
Streamable
All Known Implementing Classes:
MessageSupport

public interface Message
extends Streamable

A message is a routable instance that has a payload. The payload is opaque to the messaging system. When implementing this interface, make sure you override equals() and hashCode() such that two Message instances with equals IDs are equal.

Version:
$Revision: 2202 $ $Id: Message.java 2202 2007-02-08 10:50:26Z timfox $
Author:
Ovidiu Feodorov, Tim Fox

Field Summary
static java.lang.String FAILED_NODE_ID
           
 
Method Summary
 boolean containsHeader(java.lang.String name)
          Returns true if the Routable contains the specified header.
 long getExpiration()
           
 java.lang.Object getHeader(java.lang.String name)
          Returns the value corresponding to the header name.
 java.util.Set getHeaderNames()
          Returns a copy of the header name set.
 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)
           
 void setHeaders(java.util.Map headers)
           
 void setPersisted(boolean persisted)
           
 void setPriority(byte priority)
           
 
Methods inherited from interface org.jboss.messaging.util.Streamable
read, write
 

Field Detail

FAILED_NODE_ID

public static final java.lang.String FAILED_NODE_ID
See Also:
Constant Field Values
Method Detail

getMessageID

public long getMessageID()

isReliable

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

getExpiration

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

isExpired

public boolean isExpired()

setExpiration

public void setExpiration(long expiration)

getTimestamp

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

getPriority

public byte getPriority()

setPriority

public void setPriority(byte priority)

putHeader

public 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

public 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

public 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

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


setHeaders

public void setHeaders(java.util.Map headers)

getHeaderNames

public java.util.Set getHeaderNames()
Returns a copy of the header name set.


getHeaders

public java.util.Map getHeaders()

getPayload

public java.lang.Object getPayload()

getPayloadAsByteArray

public byte[] getPayloadAsByteArray()

isPersisted

public boolean isPersisted()

setPersisted

public void setPersisted(boolean persisted)

getType

public byte getType()


Copyright © 2006 JBoss Inc. All Rights Reserved.