org.exolab.jms.messagemgr
Interface MessageHandle

All Known Implementing Classes:
AbstractMessageHandle

public interface MessageHandle

A message handle is used to indirectly reference a message.

Version:
$Revision: 1.2 $ $Date: 2005/08/30 07:26:49 $
Author:
Jim Alateras, Tim Anderson
See Also:
MessageHandleComparator

Method Summary
 void add()
          Make the handle persistent.
 void destroy()
          Destroy this handle.
 long getAcceptedTime()
          Returns the time that the corresponding message was accepted, in milliseconds.
 long getConnectionId()
          Returns the connection identity associated with the message.
 long getConsumerId()
          Returns the consumer identity associated with the message.
 java.lang.String getConsumerPersistentId()
          Returns the persistent identity of the the consumer endpoint that owns this handle.
 boolean getDelivered()
          Returns if an attempt has already been made to deliver the message.
 JmsDestination getDestination()
          Returns the message destination.
 long getExpiryTime()
          Returns the time that the message expires, in milliseconds.
 MessageImpl getMessage()
          Returns the message associated with this handle.
 java.lang.String getMessageId()
          Returns the message identifier.
 MessageRef getMessageRef()
          Returns the message reference.
 int getPriority()
          Returns the priority of the message.
 long getSequenceNumber()
          Returns the handle's sequence number.
 boolean hasExpired()
          Determines if the message has expired.
 boolean isPersistent()
          Determines if the handle is persistent.
 void release()
          Release the message handle back to the cache, to recover an unsent or unacknowledged message.
 void setDelivered(boolean delivered)
          Indicates if a message has been delivered to a MessageConsumer, but not acknowledged.
 void update()
          Update the persistent handle.
 

Method Detail

getMessageId

public java.lang.String getMessageId()
Returns the message identifier.
Returns:
the message identifier

setDelivered

public void setDelivered(boolean delivered)
Indicates if a message has been delivered to a MessageConsumer, but not acknowledged.
Parameters:
delivered - if true indicates that an attempt has been made to deliver the message

getDelivered

public boolean getDelivered()
Returns if an attempt has already been made to deliver the message.
Returns:
true if delivery has been attempted

getPriority

public int getPriority()
Returns the priority of the message.
Returns:
the message priority

getAcceptedTime

public long getAcceptedTime()
Returns the time that the corresponding message was accepted, in milliseconds.
Returns:
the time that the corresponding message was accepted

getExpiryTime

public long getExpiryTime()
Returns the time that the message expires, in milliseconds.
Returns:
the expiry time

hasExpired

public boolean hasExpired()
Determines if the message has expired.
Returns:
true if the message has expired, otherwise false

getSequenceNumber

public long getSequenceNumber()
Returns the handle's sequence number.
Returns:
the sequence number

getDestination

public JmsDestination getDestination()
Returns the message destination.
Returns:
the message destination

getConsumerId

public long getConsumerId()
Returns the consumer identity associated with the message.
Returns:
the consumer identity associated with the message, or * -1 if the message isn't associated with a consumer

getConnectionId

public long getConnectionId()
Returns the connection identity associated with the message.
Returns:
the connection identity associated with the message, or -1 if the message isn't associated with a connection

getConsumerPersistentId

public java.lang.String getConsumerPersistentId()
Returns the persistent identity of the the consumer endpoint that owns this handle. If it is set, then a consumer owns it exclusively, otherwise the handle may be shared across a number of consumers.
Returns:
the consumer's persistent identity, or null

isPersistent

public boolean isPersistent()
Determines if the handle is persistent.
Returns:
true if the handle is persistent; otherwise false

getMessage

public MessageImpl getMessage()
                       throws javax.jms.JMSException
Returns the message associated with this handle.
Returns:
the associated message, or null if the handle is no longer valid
Throws:
javax.jms.JMSException - for any error

add

public void add()
         throws javax.jms.JMSException
Make the handle persistent.
Throws:
javax.jms.JMSException - for any persistence error

update

public void update()
            throws javax.jms.JMSException
Update the persistent handle.
Throws:
javax.jms.JMSException - for any persistence error

destroy

public void destroy()
             throws javax.jms.JMSException
Destroy this handle. If this is the last handle to reference the message, also destroys the message.
Throws:
javax.jms.JMSException - for any error

release

public void release()
             throws javax.jms.JMSException
Release the message handle back to the cache, to recover an unsent or unacknowledged message.
Throws:
javax.jms.JMSException - for any error

getMessageRef

public MessageRef getMessageRef()
Returns the message reference.
Returns:
the message reference, or null if none has been set


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.