Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.store.journal
Class JournalTopicMessageStore  view JournalTopicMessageStore download JournalTopicMessageStore.java

java.lang.Object
  extended byorg.activemq.store.journal.JournalMessageStore
      extended byorg.activemq.store.journal.JournalTopicMessageStore
All Implemented Interfaces:
org.activemq.store.cache.CacheMessageStoreAware, org.activemq.store.MessageStore, org.activemq.service.Service, org.activemq.store.TopicMessageStore

public class JournalTopicMessageStore
extends JournalMessageStore
implements org.activemq.store.TopicMessageStore

A MessageStore that uses a Journal to store it's messages.

Version:
$Revision: 1.1 $

Field Summary
private  java.util.HashMap ackedLastAckLocations
           
private static org.apache.commons.logging.Log log
           
private  org.activemq.store.TopicMessageStore longTermStore
           
 
Fields inherited from class org.activemq.store.journal.JournalMessageStore
destinationName, inFlightTxLocations, lastLocation, peristenceAdapter, removedFromJournal, transactionStore, transactionTemplate
 
Constructor Summary
JournalTopicMessageStore(JournalPersistenceAdapter adapter, org.activemq.store.TopicMessageStore checkpointStore, java.lang.String destinationName)
           
 
Method Summary
private  void acknowledge(java.lang.String subscription, org.activemq.service.MessageIdentity messageIdentity, RecordLocation location)
           
 RecordLocation checkpoint()
           
 void decrementMessageCountAndMaybeDelete(org.activemq.service.MessageIdentity messageId)
          Decrement the reference count of this message ID and if there are no more references then delete the message from persistent store (or maybe archive it off somewhere)
 void deleteSubscription(java.lang.String subscription)
           
 org.activemq.service.MessageIdentity getLastestMessageIdentity()
          Returns the last message identity that was delivered on this container which can then be used as a checkpoint so that when new durable consumers start, we know where to checkpoint their subscriptions.
 org.activemq.store.TopicMessageStore getLongTermTopicMessageStore()
           
 org.activemq.service.SubscriberEntry getSubscriberEntry(org.activemq.message.ConsumerInfo info)
          Finds the subscriber entry for the given consumer info
 void incrementMessageCount(org.activemq.service.MessageIdentity messageId)
          Increments the reference count of the message ID as its been dispatched to another subscriber.
 void recoverSubscription(java.lang.String subscriptionId, org.activemq.service.MessageIdentity lastDispatchedMessage, org.activemq.store.RecoveryListener listener)
          For the new subcription find the last acknowledged message ID and then find any new messages since then and dispatch them to the subscription.
 void replayAcknowledge(java.lang.String subscription, org.activemq.service.MessageIdentity identity)
           
 void setLastAcknowledgedMessageIdentity(java.lang.String subscription, org.activemq.service.MessageIdentity messageIdentity)
          Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching messages from the last checkpoint
 void setSubscriberEntry(org.activemq.message.ConsumerInfo info, org.activemq.service.SubscriberEntry subscriberEntry)
          Inserts or updates the subscriber info due to a subscription change
 
Methods inherited from class org.activemq.store.journal.JournalMessageStore
addMessage, getLongTermMessageStore, getMessage, recover, removeAllMessages, removeMessage, replayAddMessage, replayRemoveMessage, setCacheMessageStore, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.activemq.store.MessageStore
addMessage, getMessage, recover, removeAllMessages, removeMessage
 
Methods inherited from interface org.activemq.service.Service
start, stop
 

Field Detail

log

private static final org.apache.commons.logging.Log log

longTermStore

private org.activemq.store.TopicMessageStore longTermStore

ackedLastAckLocations

private java.util.HashMap ackedLastAckLocations
Constructor Detail

JournalTopicMessageStore

public JournalTopicMessageStore(JournalPersistenceAdapter adapter,
                                org.activemq.store.TopicMessageStore checkpointStore,
                                java.lang.String destinationName)
Method Detail

recoverSubscription

public void recoverSubscription(java.lang.String subscriptionId,
                                org.activemq.service.MessageIdentity lastDispatchedMessage,
                                org.activemq.store.RecoveryListener listener)
                         throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
For the new subcription find the last acknowledged message ID and then find any new messages since then and dispatch them to the subscription.

If this is a new subscription then the lastDispatchMessage should be written to the acknowledgement table to write a checkpoint so that when we recover we will start from the correct point.

e.g. if we dispatched some messages to a new durable topic subscriber, then went down before acknowledging any messages, we need to know the correct point from which to recover from.

Specified by:
recoverSubscription in interface org.activemq.store.TopicMessageStore

getSubscriberEntry

public org.activemq.service.SubscriberEntry getSubscriberEntry(org.activemq.message.ConsumerInfo info)
                                                        throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
Finds the subscriber entry for the given consumer info

Specified by:
getSubscriberEntry in interface org.activemq.store.TopicMessageStore

setSubscriberEntry

public void setSubscriberEntry(org.activemq.message.ConsumerInfo info,
                               org.activemq.service.SubscriberEntry subscriberEntry)
                        throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
Inserts or updates the subscriber info due to a subscription change

Specified by:
setSubscriberEntry in interface org.activemq.store.TopicMessageStore

getLastestMessageIdentity

public org.activemq.service.MessageIdentity getLastestMessageIdentity()
                                                               throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
Returns the last message identity that was delivered on this container which can then be used as a checkpoint so that when new durable consumers start, we know where to checkpoint their subscriptions.

Note that this method does not need to return a valid messageID, purely the sequence number.

Specified by:
getLastestMessageIdentity in interface org.activemq.store.TopicMessageStore

incrementMessageCount

public void incrementMessageCount(org.activemq.service.MessageIdentity messageId)
                           throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
Increments the reference count of the message ID as its been dispatched to another subscriber.

Specified by:
incrementMessageCount in interface org.activemq.store.TopicMessageStore

decrementMessageCountAndMaybeDelete

public void decrementMessageCountAndMaybeDelete(org.activemq.service.MessageIdentity messageId)
                                         throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
Decrement the reference count of this message ID and if there are no more references then delete the message from persistent store (or maybe archive it off somewhere)

Specified by:
decrementMessageCountAndMaybeDelete in interface org.activemq.store.TopicMessageStore

setLastAcknowledgedMessageIdentity

public void setLastAcknowledgedMessageIdentity(java.lang.String subscription,
                                               org.activemq.service.MessageIdentity messageIdentity)
                                        throws javax.jms.JMSException
Description copied from interface: org.activemq.store.TopicMessageStore
Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching messages from the last checkpoint

Specified by:
setLastAcknowledgedMessageIdentity in interface org.activemq.store.TopicMessageStore

acknowledge

private void acknowledge(java.lang.String subscription,
                         org.activemq.service.MessageIdentity messageIdentity,
                         RecordLocation location)

checkpoint

public RecordLocation checkpoint()
                          throws javax.jms.JMSException
Overrides:
checkpoint in class JournalMessageStore

getLongTermTopicMessageStore

public org.activemq.store.TopicMessageStore getLongTermTopicMessageStore()

deleteSubscription

public void deleteSubscription(java.lang.String subscription)
                        throws javax.jms.JMSException
Specified by:
deleteSubscription in interface org.activemq.store.TopicMessageStore

replayAcknowledge

public void replayAcknowledge(java.lang.String subscription,
                              org.activemq.service.MessageIdentity identity)