Package org.apache.activemq.store
Interface PersistenceAdapter
- All Superinterfaces:
org.apache.activemq.Service
- All Known Implementing Classes:
MemoryPersistenceAdapter
public interface PersistenceAdapter
extends org.apache.activemq.Service
Adapter to the actual persistence mechanism used with ActiveMQ
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbeginTransaction(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.voidcheckpoint(boolean cleanup) checkpoint anyvoidcommitTransaction(ConnectionContext context) Commit a persistence transactionCreates and returns a new Job Scheduler store instance.createQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) Factory method to create a new queue message store with the given destination namecreateTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination) Factory method to create a new topic message store with the given destination nameFactory method to create a new persistent prepared transaction store for XA recoveryvoidDelete's all the messages in the persistent store.Set<org.apache.activemq.command.ActiveMQDestination>Returns a set of all theActiveMQDestinationobjects that the persistence store is aware exist.longlonggetLastProducerSequenceId(org.apache.activemq.command.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 occursvoidremoveQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) Cleanup method to remove any state associated with the given destination.voidremoveTopicMessageStore(org.apache.activemq.command.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).voidrollbackTransaction(ConnectionContext context) Rollback a persistence transactionvoidsetBrokerName(String brokerName) Set the name of the broker using the adaptervoidsetDirectory(File dir) Set the directory where any data files should be createdvoidsetUsageManager(SystemUsage usageManager) longsize()A hint to return the size of the store on diskMethods inherited from interface org.apache.activemq.Service
start, stop
-
Method Details
-
getDestinations
Set<org.apache.activemq.command.ActiveMQDestination> getDestinations()Returns a set of all theActiveMQDestinationobjects that the persistence store is aware exist.- Returns:
- active destinations
-
createQueueMessageStore
MessageStore createQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) throws IOException Factory method to create a new queue message store with the given destination name- Parameters:
destination-- Returns:
- the message store
- Throws:
IOException
-
createTopicMessageStore
TopicMessageStore createTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination) throws IOException Factory method to create a new topic message store with the given destination name- Parameters:
destination-- Returns:
- the topic message store
- Throws:
IOException
-
createJobSchedulerStore
Creates and returns a new Job Scheduler store instance.- Returns:
- a new JobSchedulerStore instance if this Persistence adapter provides its own.
- Throws:
IOException- If an error occurs while creating the new JobSchedulerStore.UnsupportedOperationException- If this adapter does not provide its own scheduler store implementation.
-
removeQueueMessageStore
void removeQueueMessageStore(org.apache.activemq.command.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(org.apache.activemq.command.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
Factory method to create a new persistent prepared transaction store for XA recovery- Returns:
- transaction store
- Throws:
IOException
-
beginTransaction
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:
IOException
-
commitTransaction
Commit a persistence transaction- Parameters:
context-- Throws:
IOException- See Also:
-
rollbackTransaction
Rollback a persistence transaction- Parameters:
context-- Throws:
IOException- See Also:
-
getLastMessageBrokerSequenceId
- Returns:
- last broker sequence
- Throws:
IOException
-
deleteAllMessages
Delete's all the messages in the persistent store.- Throws:
IOException
-
setUsageManager
- Parameters:
usageManager- The UsageManager that is controlling the broker's memory usage.
-
setBrokerName
Set the name of the broker using the adapter- Parameters:
brokerName-
-
setDirectory
Set the directory where any data files should be created- Parameters:
dir-
-
getDirectory
File getDirectory()- Returns:
- the directory used by the persistence adaptor
-
checkpoint
checkpoint any- Parameters:
cleanup-- Throws:
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
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:
IOException
-
allowIOResumption
void allowIOResumption()
-