org.codehaus.activemq.service.impl
Class DurableTopicMessageContainer

java.lang.Object
  extended byorg.codehaus.activemq.service.impl.DurableTopicMessageContainer
All Implemented Interfaces:
MessageContainer, Service, TopicMessageContainer

public class DurableTopicMessageContainer
extends Object
implements TopicMessageContainer

A default implemenation of a Durable Topic based MessageContainer which acts as an adapter between the MessageContainerManager requirements and those of the persistent TopicMessageStore implementations.

Version:
$Revision: 1.14 $

Constructor Summary
DurableTopicMessageContainer(TopicMessageStore messageStore, String destinationName)
           
 
Method Summary
 MessageIdentity addMessage(ActiveMQMessage message)
          Add an ActiveMQMessage to the message container
 boolean containsMessage(MessageIdentity messageIdentity)
          Returns whether or not this container contains the given message identity which provides an optimisation over getMessage() where the message does not need to be loaded.
 void delete(MessageIdentity messageID, MessageAck ack)
          Delete a message - if no
 String getDestinationName()
           
 ActiveMQMessage getMessage(MessageIdentity messageID)
          Return the ActiveMQMessage that matches the Id
 void recoverSubscription(Subscription subscription)
          A durable subscription has started so recovery any messages that are required.
 void registerMessageInterest(MessageIdentity messageIdentity)
          Register that a consumer will be interested in this message
 void setLastAcknowledgedMessageID(Subscription subscription, MessageIdentity messageIdentity)
          Sets the last acknowleged message ID for the given subscriber in this container so that if we shut down and recover we know where to start replaying messages from.
 void start()
          Called to start the service
 void stop()
          Called to shutdown the service
 void storeSubscription(ConsumerInfo info, Subscription subscription)
          Stores the persistence details in the database
 void unregisterMessageInterest(MessageIdentity messageIdentity, MessageAck ack)
          A message consumer calls this when it's no longer interested in a message so that we know when we can delete (or archive) it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DurableTopicMessageContainer

public DurableTopicMessageContainer(TopicMessageStore messageStore,
                                    String destinationName)
Method Detail

getDestinationName

public String getDestinationName()
Specified by:
getDestinationName in interface MessageContainer
Returns:
the destinationName of the Container

addMessage

public MessageIdentity addMessage(ActiveMQMessage message)
                           throws JMSException
Description copied from interface: MessageContainer
Add an ActiveMQMessage to the message container

Specified by:
addMessage in interface MessageContainer
Parameters:
message -
Throws:
JMSException

delete

public void delete(MessageIdentity messageID,
                   MessageAck ack)
            throws JMSException
Description copied from interface: MessageContainer
Delete a message - if no

Specified by:
delete in interface MessageContainer
Parameters:
messageID -
ack -
Throws:
JMSException

containsMessage

public boolean containsMessage(MessageIdentity messageIdentity)
                        throws JMSException
Description copied from interface: MessageContainer
Returns whether or not this container contains the given message identity which provides an optimisation over getMessage() where the message does not need to be loaded.

Specified by:
containsMessage in interface MessageContainer
Parameters:
messageIdentity -
Returns:
true if the container contains the given message
Throws:
JMSException

getMessage

public ActiveMQMessage getMessage(MessageIdentity messageID)
                           throws JMSException
Description copied from interface: MessageContainer
Return the ActiveMQMessage that matches the Id

Specified by:
getMessage in interface MessageContainer
Parameters:
messageID -
Returns:
the message or null
Throws:
JMSException

registerMessageInterest

public void registerMessageInterest(MessageIdentity messageIdentity)
                             throws JMSException
Description copied from interface: MessageContainer
Register that a consumer will be interested in this message

Specified by:
registerMessageInterest in interface MessageContainer
Parameters:
messageIdentity -
Throws:
JMSException

unregisterMessageInterest

public void unregisterMessageInterest(MessageIdentity messageIdentity,
                                      MessageAck ack)
                               throws JMSException
Description copied from interface: MessageContainer
A message consumer calls this when it's no longer interested in a message so that we know when we can delete (or archive) it

Specified by:
unregisterMessageInterest in interface MessageContainer
Parameters:
messageIdentity -
ack -
Throws:
JMSException

setLastAcknowledgedMessageID

public void setLastAcknowledgedMessageID(Subscription subscription,
                                         MessageIdentity messageIdentity)
                                  throws JMSException
Description copied from interface: TopicMessageContainer
Sets the last acknowleged message ID for the given subscriber in this container so that if we shut down and recover we know where to start replaying messages from.

Specified by:
setLastAcknowledgedMessageID in interface TopicMessageContainer
Parameters:
subscription -
messageIdentity -
Throws:
JMSException

recoverSubscription

public void recoverSubscription(Subscription subscription)
                         throws JMSException
Description copied from interface: TopicMessageContainer
A durable subscription has started so recovery any messages that are required. This method should find the last acknowledged message for the given subscription and then iterate through any further messages and those that match the subscription should be dispatched to this subscription so that they can be dispatched in the future

Specified by:
recoverSubscription in interface TopicMessageContainer
Parameters:
subscription -
Throws:
JMSException

storeSubscription

public void storeSubscription(ConsumerInfo info,
                              Subscription subscription)
                       throws JMSException
Description copied from interface: TopicMessageContainer
Stores the persistence details in the database

Specified by:
storeSubscription in interface TopicMessageContainer
Parameters:
info -
subscription -
Throws:
JMSException

start

public void start()
           throws JMSException
Description copied from interface: Service
Called to start the service

Specified by:
start in interface Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
Description copied from interface: Service
Called to shutdown the service

Specified by:
stop in interface Service
Throws:
JMSException


Copyright © 2004 Protique, Ltd.. All Rights Reserved.