org.activemq.store.journal
Class JournalMessageStore

java.lang.Object
  extended byorg.activemq.store.journal.JournalMessageStore
All Implemented Interfaces:
CacheMessageStoreAware, MessageStore, Service
Direct Known Subclasses:
JournalTopicMessageStore

public class JournalMessageStore
extends Object
implements MessageStore, CacheMessageStoreAware

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

Version:
$Revision: 1.1 $

Field Summary
protected  String destinationName
           
protected  HashSet inFlightTxLocations
           
protected  org.activeio.journal.RecordLocation lastLocation
           
protected  MessageStore longTermStore
           
protected  JournalPersistenceAdapter peristenceAdapter
           
protected  JournalTransactionStore transactionStore
           
protected  TransactionTemplate transactionTemplate
           
 
Constructor Summary
JournalMessageStore(JournalPersistenceAdapter adapter, MessageStore checkpointStore, String destinationName)
           
 
Method Summary
 void addMessage(ActiveMQMessage message)
          Not synchronized since the Journal has better throughput if you increase the number of conncurrent writes that it is doing.
 org.activeio.journal.RecordLocation checkpoint()
           
 MessageStore getLongTermMessageStore()
           
 ActiveMQMessage getMessage(MessageIdentity identity)
          Looks up a message using either the String messageID or the messageNumber.
 void recover(RecoveryListener listener)
          Replays the checkpointStore first as those messages are the oldest ones, then messages are replayed from the transaction log and then the cache is updated.
 void removeAllMessages()
          Removes all the messages from the message store.
 void removeMessage(MessageAck ack)
          Removes a message from the message store.
 void replayAddMessage(ActiveMQMessage msg)
           
 void replayRemoveMessage(MessageAck ack)
           
 void setCacheMessageStore(CacheMessageStore store)
           
 void start()
          Called to start the service
 void stop()
          Called to shutdown the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peristenceAdapter

protected final JournalPersistenceAdapter peristenceAdapter

longTermStore

protected final MessageStore longTermStore

destinationName

protected final String destinationName

transactionTemplate

protected final TransactionTemplate transactionTemplate

inFlightTxLocations

protected HashSet inFlightTxLocations

lastLocation

protected org.activeio.journal.RecordLocation lastLocation

transactionStore

protected final JournalTransactionStore transactionStore
Constructor Detail

JournalMessageStore

public JournalMessageStore(JournalPersistenceAdapter adapter,
                           MessageStore checkpointStore,
                           String destinationName)
Method Detail

addMessage

public void addMessage(ActiveMQMessage message)
                throws JMSException
Not synchronized since the Journal has better throughput if you increase the number of conncurrent writes that it is doing.

Specified by:
addMessage in interface MessageStore
Throws:
JMSException

removeMessage

public void removeMessage(MessageAck ack)
                   throws JMSException
Description copied from interface: MessageStore
Removes a message from the message store.

Specified by:
removeMessage in interface MessageStore
Parameters:
ack - the ack request that cause the message to be removed. It conatins the identity which contains the messageID of the message that needs to be removed.
Throws:
JMSException

checkpoint

public org.activeio.journal.RecordLocation checkpoint()
                                               throws JMSException
Returns:
Throws:
JMSException

getMessage

public ActiveMQMessage getMessage(MessageIdentity identity)
                           throws JMSException
Description copied from interface: MessageStore
Looks up a message using either the String messageID or the messageNumber. Implementations are encouraged to fill in the missing key if its easy to do so.

Specified by:
getMessage in interface MessageStore
Parameters:
identity - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
JMSException

recover

public void recover(RecoveryListener listener)
             throws JMSException
Replays the checkpointStore first as those messages are the oldest ones, then messages are replayed from the transaction log and then the cache is updated.

Specified by:
recover in interface MessageStore
Parameters:
listener -
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

getLongTermMessageStore

public MessageStore getLongTermMessageStore()
Returns:
Returns the longTermStore.

setCacheMessageStore

public void setCacheMessageStore(CacheMessageStore store)
Specified by:
setCacheMessageStore in interface CacheMessageStoreAware
See Also:
CacheMessageStoreAware.setCacheMessageStore(org.activemq.store.cache.CacheMessageStore)

removeAllMessages

public void removeAllMessages()
                       throws JMSException
Description copied from interface: MessageStore
Removes all the messages from the message store.

Specified by:
removeAllMessages in interface MessageStore
Throws:
JMSException
See Also:
MessageStore.removeAllMessages()

replayAddMessage

public void replayAddMessage(ActiveMQMessage msg)

replayRemoveMessage

public void replayRemoveMessage(MessageAck ack)


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