org.jboss.messaging.core
Interface Routable

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
Message, MessageReference
All Known Implementing Classes:
MessageSupport, RoutableSupport, SimpleMessageReference

public interface Routable
extends java.io.Serializable

An atomic, self containted unit of data that is being routed by the messaging system. Each routable maintains a set of headers. Various messaging components can attach or remove headers, primarily for message flow management purposes.

Version:
$Revision: 1569 $ $Id: Routable.java 1569 2006-11-17 02:08:56Z ovidiu.feodorov@jboss.com $
Author:
Ovidiu Feodorov, Tim Fox
See Also:
Message, MessageReference

Field Summary
static java.lang.String COLLECTOR_ID
           
static java.lang.String REMOTE_ROUTABLE
           
static java.lang.String REPLICATOR_ID
           
 
Method Summary
 boolean containsHeader(java.lang.String name)
          Returns true if the Routable contains the specified header.
 void decrementDeliveryCount()
           
 int getDeliveryCount()
           
 long getExpiration()
           
 java.io.Serializable 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()
           
 Message getMessage()
          If it is a Message instance, then it returns itself, otherwise it will return the Message corresponding to this MessageReference.
 long getMessageID()
           
 byte getPriority()
           
 long getTimestamp()
           
 void incrementDeliveryCount()
           
 boolean isExpired()
           
 boolean isReference()
           
 boolean isReliable()
           
 java.io.Serializable putHeader(java.lang.String name, java.io.Serializable value)
          Binds a header.
 java.io.Serializable removeHeader(java.lang.String name)
          Removes the header.
 void setDeliveryCount(int deliveryCount)
           
 void setPriority(byte priority)
           
 void setReliable(boolean reliable)
           
 

Field Detail

REMOTE_ROUTABLE

public static final java.lang.String REMOTE_ROUTABLE
See Also:
Constant Field Values

REPLICATOR_ID

public static final java.lang.String REPLICATOR_ID
See Also:
Constant Field Values

COLLECTOR_ID

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

getMessageID

public long getMessageID()

getMessage

public Message getMessage()
If it is a Message instance, then it returns itself, otherwise it will return the Message corresponding to this MessageReference.


isReference

public boolean isReference()

isReliable

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

setReliable

public void setReliable(boolean reliable)

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()

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)

getDeliveryCount

public int getDeliveryCount()
Returns:
the number of times delivery has been attempted for this routable

setDeliveryCount

public void setDeliveryCount(int deliveryCount)

incrementDeliveryCount

public void incrementDeliveryCount()

decrementDeliveryCount

public void decrementDeliveryCount()

putHeader

public java.io.Serializable putHeader(java.lang.String name,
                                      java.io.Serializable 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.io.Serializable 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.io.Serializable 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.


getHeaderNames

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


getHeaders

public java.util.Map getHeaders()


Copyright © 2006 JBoss Inc. All Rights Reserved.