org.exolab.jms.messagemgr
Class PersistentMessageHandle

java.lang.Object
  |
  +--org.exolab.jms.messagemgr.AbstractMessageHandle
        |
        +--org.exolab.jms.messagemgr.PersistentMessageHandle
All Implemented Interfaces:
MessageHandle

public class PersistentMessageHandle
extends AbstractMessageHandle

A persistent message handle extends MessageHandle and references a persistent message. These messages can be discarded from the cache and later faulted in.

Version:
$Revision: 1.4 $ $Date: 2005/10/20 14:20:27 $
Author:
Jim Alateras, Tim Anderson

Constructor Summary
PersistentMessageHandle(MessageImpl message, java.lang.String persistentId)
          Construct a new PersistentMessageHandle, for a particular consumer.
PersistentMessageHandle(java.lang.String messageId, int priority, long acceptedTime, long sequenceNumber, long expiryTime, JmsDestination destination)
          Construct a new PersistentMessageHandle.
PersistentMessageHandle(java.lang.String messageId, int priority, long acceptedTime, long sequenceNumber, long expiryTime, JmsDestination destination, java.lang.String persistentId)
          Construct a new PersistentMessageHandle, for a particular consumer.
 
Method Summary
 void add()
          Make the handle persistent.
 void destroy()
          Destroy this handle.
 java.lang.String getConsumerPersistentId()
          Returns the persistent identity of the the consumer endpoint that owns this handle.
 boolean isPersistent()
          Determines if the handle is persistent.
 void reference(MessageRef reference)
          Reference a message.
 void update()
          Update this handle.
 
Methods inherited from class org.exolab.jms.messagemgr.AbstractMessageHandle
equals, getAcceptedTime, getConnectionId, getConsumerId, getDelivered, getDestination, getExpiryTime, getMessage, getMessageId, getMessageRef, getPriority, getSequenceNumber, hasExpired, hashCode, release, release, setDelivered, setDestinationCache, setMessageRef, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistentMessageHandle

public PersistentMessageHandle(MessageImpl message,
                               java.lang.String persistentId)
                        throws javax.jms.JMSException
Construct a new PersistentMessageHandle, for a particular consumer.
Parameters:
message - the message to construct the handle for
persistentId - the persistent identity of the consumer. May be null.
Throws:
javax.jms.JMSException - for any error

PersistentMessageHandle

public PersistentMessageHandle(java.lang.String messageId,
                               int priority,
                               long acceptedTime,
                               long sequenceNumber,
                               long expiryTime,
                               JmsDestination destination)
Construct a new PersistentMessageHandle.
Parameters:
messageId - the message identifier
priority - the message priority
acceptedTime - the time the message was accepted by the server
sequenceNumber - the message sequence number
expiryTime - the time that the message will expire

PersistentMessageHandle

public PersistentMessageHandle(java.lang.String messageId,
                               int priority,
                               long acceptedTime,
                               long sequenceNumber,
                               long expiryTime,
                               JmsDestination destination,
                               java.lang.String persistentId)
Construct a new PersistentMessageHandle, for a particular consumer.
Parameters:
messageId - the message identifier
priority - the message priority
acceptedTime - the time the message was accepted by the server
sequenceNumber - the message sequence number
expiryTime - the time that the message will expire
persistentId - the persistent identity of the consumer. May be null.
Method Detail

isPersistent

public boolean isPersistent()
Determines if the handle is persistent.
Overrides:
isPersistent in class AbstractMessageHandle
Returns:
true

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 this handle.
Throws:
javax.jms.JMSException - for any persistence error

reference

public void reference(MessageRef reference)
               throws javax.jms.JMSException
Reference a message.
Throws:
javax.jms.JMSException - for any error

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.
Overrides:
getConsumerPersistentId in class AbstractMessageHandle
Returns:
the consumer's persistent identity, or null

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.
Overrides:
destroy in class AbstractMessageHandle
Throws:
javax.jms.JMSException - for any error


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