org.apache.activemq.store.journal
Class JournalMessageStore

java.lang.Object
  extended by org.apache.activemq.store.AbstractMessageStore
      extended by org.apache.activemq.store.journal.JournalMessageStore
All Implemented Interfaces:
org.apache.activemq.Service, MessageStore
Direct Known Subclasses:
JournalTopicMessageStore

public class JournalMessageStore
extends AbstractMessageStore

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


Field Summary
protected  Set<org.apache.activeio.journal.RecordLocation> inFlightTxLocations
           
protected  org.apache.activeio.journal.RecordLocation lastLocation
           
protected  MessageStore longTermStore
           
protected  JournalPersistenceAdapter peristenceAdapter
           
protected  JournalTransactionStore transactionStore
           
protected  TransactionTemplate transactionTemplate
           
 
Fields inherited from class org.apache.activemq.store.AbstractMessageStore
destination, FUTURE, prioritizedMessages
 
Constructor Summary
JournalMessageStore(JournalPersistenceAdapter adapter, MessageStore checkpointStore, org.apache.activemq.command.ActiveMQDestination destination)
           
 
Method Summary
 void addMessage(ConnectionContext context, org.apache.activemq.command.Message message)
          Not synchronized since the Journal has better throughput if you increase the number of concurrent writes that it is doing.
 void addMessageReference(ConnectionContext context, org.apache.activemq.command.MessageId messageId, long expirationTime, String messageRef)
           
 org.apache.activeio.journal.RecordLocation checkpoint()
           
 org.apache.activeio.journal.RecordLocation checkpoint(Callback postCheckpointTest)
           
 MessageStore getLongTermMessageStore()
           
 org.apache.activemq.command.Message getMessage(org.apache.activemq.command.MessageId identity)
           
 int getMessageCount()
           
 String getMessageReference(org.apache.activemq.command.MessageId identity)
           
 void recover(MessageRecoveryListener 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 recoverNextMessages(int maxReturned, MessageRecoveryListener listener)
           
 void removeAllMessages(ConnectionContext context)
           
 void removeMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack)
           
 void replayAddMessage(ConnectionContext context, org.apache.activemq.command.Message message)
           
 void replayRemoveMessage(ConnectionContext context, org.apache.activemq.command.MessageAck messageAck)
           
 void resetBatching()
           
 void setBatch(org.apache.activemq.command.MessageId messageId)
           
 void setMemoryUsage(MemoryUsage memoryUsage)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.activemq.store.AbstractMessageStore
addMessage, asyncAddQueueMessage, asyncAddQueueMessage, asyncAddTopicMessage, asyncAddTopicMessage, dispose, getDestination, isEmpty, isPrioritizedMessages, removeAsyncMessage, setPrioritizedMessages
 
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

transactionStore

protected final JournalTransactionStore transactionStore

longTermStore

protected final MessageStore longTermStore

transactionTemplate

protected final TransactionTemplate transactionTemplate

lastLocation

protected org.apache.activeio.journal.RecordLocation lastLocation

inFlightTxLocations

protected Set<org.apache.activeio.journal.RecordLocation> inFlightTxLocations
Constructor Detail

JournalMessageStore

public JournalMessageStore(JournalPersistenceAdapter adapter,
                           MessageStore checkpointStore,
                           org.apache.activemq.command.ActiveMQDestination destination)
Method Detail

setMemoryUsage

public void setMemoryUsage(MemoryUsage memoryUsage)
Specified by:
setMemoryUsage in interface MessageStore
Overrides:
setMemoryUsage in class AbstractMessageStore

addMessage

public void addMessage(ConnectionContext context,
                       org.apache.activemq.command.Message message)
                throws IOException
Not synchronized since the Journal has better throughput if you increase the number of concurrent writes that it is doing.

Throws:
IOException

replayAddMessage

public void replayAddMessage(ConnectionContext context,
                             org.apache.activemq.command.Message message)

removeMessage

public void removeMessage(ConnectionContext context,
                          org.apache.activemq.command.MessageAck ack)
                   throws IOException
Throws:
IOException

replayRemoveMessage

public void replayRemoveMessage(ConnectionContext context,
                                org.apache.activemq.command.MessageAck messageAck)

checkpoint

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

checkpoint

public org.apache.activeio.journal.RecordLocation checkpoint(Callback postCheckpointTest)
                                                      throws IOException
Returns:
Throws:
IOException

getMessage

public org.apache.activemq.command.Message getMessage(org.apache.activemq.command.MessageId identity)
                                               throws IOException
Throws:
IOException

recover

public void recover(MessageRecoveryListener listener)
             throws Exception
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.

Parameters:
listener -
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in interface org.apache.activemq.Service
Overrides:
start in class AbstractMessageStore
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface org.apache.activemq.Service
Overrides:
stop in class AbstractMessageStore
Throws:
Exception

getLongTermMessageStore

public MessageStore getLongTermMessageStore()
Returns:
Returns the longTermStore.

removeAllMessages

public void removeAllMessages(ConnectionContext context)
                       throws IOException
Throws:
IOException
See Also:
MessageStore.removeAllMessages(ConnectionContext)

addMessageReference

public void addMessageReference(ConnectionContext context,
                                org.apache.activemq.command.MessageId messageId,
                                long expirationTime,
                                String messageRef)
                         throws IOException
Throws:
IOException

getMessageReference

public String getMessageReference(org.apache.activemq.command.MessageId identity)
                           throws IOException
Throws:
IOException

getMessageCount

public int getMessageCount()
                    throws IOException
Returns:
Throws:
IOException
See Also:
MessageStore.getMessageCount()

recoverNextMessages

public void recoverNextMessages(int maxReturned,
                                MessageRecoveryListener listener)
                         throws Exception
Throws:
Exception

resetBatching

public void resetBatching()

setBatch

public void setBatch(org.apache.activemq.command.MessageId messageId)
              throws Exception
Specified by:
setBatch in interface MessageStore
Overrides:
setBatch in class AbstractMessageStore
Throws:
Exception


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.