org.apache.activemq.store
Interface PersistenceAdapter

All Superinterfaces:
Service
All Known Subinterfaces:
ReferenceStoreAdapter
All Known Implementing Classes:
AMQPersistenceAdapter, JDBCPersistenceAdapter, JournalPersistenceAdapter, KahaDBPersistenceAdapter, KahaDBStore, KahaPersistenceAdapter, KahaReferenceStoreAdapter, MemoryPersistenceAdapter, TempKahaDBStore

public interface PersistenceAdapter
extends Service

Adapter to the actual persistence mechanism used with ActiveMQ


Method Summary
 void beginTransaction(ConnectionContext context)
          This method starts a transaction on the persistent storage - which is nothing to do with JMS or XA transactions - its purely a mechanism to perform multiple writes to a persistent store in 1 transaction as a performance optimization.
 void checkpoint(boolean sync)
          checkpoint any
 void commitTransaction(ConnectionContext context)
          Commit a persistence transaction
 MessageStore createQueueMessageStore(ActiveMQQueue destination)
          Factory method to create a new queue message store with the given destination name
 TopicMessageStore createTopicMessageStore(ActiveMQTopic destination)
          Factory method to create a new topic message store with the given destination name
 TransactionStore createTransactionStore()
          Factory method to create a new persistent prepared transaction store for XA recovery
 void deleteAllMessages()
          Delete's all the messages in the persistent store.
 java.util.Set<ActiveMQDestination> getDestinations()
          Returns a set of all the ActiveMQDestination objects that the persistence store is aware exist.
 long getLastMessageBrokerSequenceId()
           
 long getLastProducerSequenceId(ProducerId id)
          return the last stored producer sequenceId for this producer Id used to suppress duplicate sends on failover reconnect at the transport when a reconnect occurs
 void removeQueueMessageStore(ActiveMQQueue destination)
          Cleanup method to remove any state associated with the given destination.
 void removeTopicMessageStore(ActiveMQTopic destination)
          Cleanup method to remove any state associated with the given destination This method does not stop the message store (it might not be cached).
 void rollbackTransaction(ConnectionContext context)
          Rollback a persistence transaction
 void setBrokerName(java.lang.String brokerName)
          Set the name of the broker using the adapter
 void setDirectory(java.io.File dir)
          Set the directory where any data files should be created
 void setUsageManager(SystemUsage usageManager)
           
 long size()
          A hint to return the size of the store on disk
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Method Detail

getDestinations

java.util.Set<ActiveMQDestination> getDestinations()
Returns a set of all the ActiveMQDestination objects that the persistence store is aware exist.

Returns:
active destinations

createQueueMessageStore

MessageStore createQueueMessageStore(ActiveMQQueue destination)
                                     throws java.io.IOException
Factory method to create a new queue message store with the given destination name

Parameters:
destination -
Returns:
the message store
Throws:
java.io.IOException

createTopicMessageStore

TopicMessageStore createTopicMessageStore(ActiveMQTopic destination)
                                          throws java.io.IOException
Factory method to create a new topic message store with the given destination name

Parameters:
destination -
Returns:
the topic message store
Throws:
java.io.IOException

removeQueueMessageStore

void removeQueueMessageStore(ActiveMQQueue destination)
Cleanup method to remove any state associated with the given destination. This method does not stop the message store (it might not be cached).

Parameters:
destination - Destination to forget

removeTopicMessageStore

void removeTopicMessageStore(ActiveMQTopic destination)
Cleanup method to remove any state associated with the given destination This method does not stop the message store (it might not be cached).

Parameters:
destination - Destination to forget

createTransactionStore

TransactionStore createTransactionStore()
                                        throws java.io.IOException
Factory method to create a new persistent prepared transaction store for XA recovery

Returns:
transaction store
Throws:
java.io.IOException

beginTransaction

void beginTransaction(ConnectionContext context)
                      throws java.io.IOException
This method starts a transaction on the persistent storage - which is nothing to do with JMS or XA transactions - its purely a mechanism to perform multiple writes to a persistent store in 1 transaction as a performance optimization.

Typically one transaction will require one disk synchronization point and so for real high performance its usually faster to perform many writes within the same transaction to minimize latency caused by disk synchronization. This is especially true when using tools like Berkeley Db or embedded JDBC servers.

Parameters:
context -
Throws:
java.io.IOException

commitTransaction

void commitTransaction(ConnectionContext context)
                       throws java.io.IOException
Commit a persistence transaction

Parameters:
context -
Throws:
java.io.IOException
See Also:
beginTransaction(ConnectionContext context)

rollbackTransaction

void rollbackTransaction(ConnectionContext context)
                         throws java.io.IOException
Rollback a persistence transaction

Parameters:
context -
Throws:
java.io.IOException
See Also:
beginTransaction(ConnectionContext context)

getLastMessageBrokerSequenceId

long getLastMessageBrokerSequenceId()
                                    throws java.io.IOException
Returns:
last broker sequence
Throws:
java.io.IOException

deleteAllMessages

void deleteAllMessages()
                       throws java.io.IOException
Delete's all the messages in the persistent store.

Throws:
java.io.IOException

setUsageManager

void setUsageManager(SystemUsage usageManager)
Parameters:
usageManager - The UsageManager that is controlling the broker's memory usage.

setBrokerName

void setBrokerName(java.lang.String brokerName)
Set the name of the broker using the adapter

Parameters:
brokerName -

setDirectory

void setDirectory(java.io.File dir)
Set the directory where any data files should be created

Parameters:
dir -

checkpoint

void checkpoint(boolean sync)
                throws java.io.IOException
checkpoint any

Parameters:
sync -
Throws:
java.io.IOException

size

long size()
A hint to return the size of the store on disk

Returns:
disk space used in bytes of 0 if not implemented

getLastProducerSequenceId

long getLastProducerSequenceId(ProducerId id)
                               throws java.io.IOException
return the last stored producer sequenceId for this producer Id used to suppress duplicate sends on failover reconnect at the transport when a reconnect occurs

Parameters:
id - the producerId to find a sequenceId for
Returns:
the last stored sequence id or -1 if no suppression needed
Throws:
java.io.IOException


Copyright © 2005-2011 FuseSource, Corp.. All Rights Reserved.