org.apache.qpid.server.store
Class MemoryMessageStore

java.lang.Object
  extended by org.apache.qpid.server.store.MemoryMessageStore
All Implemented Interfaces:
DurableConfigurationStore, MessageStore, TransactionLog

public class MemoryMessageStore
extends Object
implements MessageStore

A simple message store that stores the messages in a threadsafe structure in memory.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.qpid.server.store.DurableConfigurationStore
DurableConfigurationStore.Source
 
Nested classes/interfaces inherited from interface org.apache.qpid.server.store.TransactionLog
TransactionLog.StoreFuture, TransactionLog.Transaction
 
Field Summary
 
Fields inherited from interface org.apache.qpid.server.store.MessageStore
IMMEDIATE_FUTURE
 
Constructor Summary
MemoryMessageStore()
           
 
Method Summary
 StoredMessage addMessage(StorableMessageMetaData metaData)
           
 void bindQueue(Exchange exchange, org.apache.qpid.framing.AMQShortString routingKey, AMQQueue queue, org.apache.qpid.framing.FieldTable args)
          Binds the specified queue to an exchange with a routing key.
 void close()
          Called to close and cleanup any resources used by the message store.
 void configureConfigStore(String name, ConfigurationRecoveryHandler handler, Configuration configuration, LogSubject logSubject)
          Called after instantiation in order to configure the message store.
 void configureMessageStore(String name, MessageStoreRecoveryHandler recoveryHandler, Configuration config, LogSubject logSubject)
          Called after instantiation in order to configure the message store.
 void configureTransactionLog(String name, TransactionLogRecoveryHandler recoveryHandler, Configuration storeConfiguration, LogSubject logSubject)
           
 void createExchange(Exchange exchange)
          Makes the specified exchange persistent.
 void createQueue(AMQQueue queue)
          Makes the specified queue persistent.
 void createQueue(AMQQueue queue, org.apache.qpid.framing.FieldTable arguments)
          Makes the specified queue persistent.
 List<AMQQueue> createQueues()
           
 Long getNewMessageId()
           
 boolean isPersistent()
          Is this store capable of persisting the data
 TransactionLog.Transaction newTransaction()
           
 void removeExchange(Exchange exchange)
          Removes the specified persistent exchange.
 void removeQueue(AMQQueue queue)
          Removes the specified queue from the persistent store.
 void unbindQueue(Exchange exchange, org.apache.qpid.framing.AMQShortString routingKey, AMQQueue queue, org.apache.qpid.framing.FieldTable args)
          Unbinds the specified from an exchange under a particular routing key.
 void updateQueue(AMQQueue queue)
          Updates the specified queue in the persistent store, IF it is already present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryMessageStore

public MemoryMessageStore()
Method Detail

configureConfigStore

public void configureConfigStore(String name,
                                 ConfigurationRecoveryHandler handler,
                                 Configuration configuration,
                                 LogSubject logSubject)
                          throws Exception
Description copied from interface: DurableConfigurationStore
Called after instantiation in order to configure the message store. A particular implementation can define whatever parameters it wants.

Specified by:
configureConfigStore in interface DurableConfigurationStore
Parameters:
name - The name to be used by this storem
handler - Handler to be called as the store recovers on start up
configuration - The apache commons configuration object.
Throws:
Exception - If any error occurs that means the store is unable to configure itself.

configureMessageStore

public void configureMessageStore(String name,
                                  MessageStoreRecoveryHandler recoveryHandler,
                                  Configuration config,
                                  LogSubject logSubject)
                           throws Exception
Description copied from interface: MessageStore
Called after instantiation in order to configure the message store. A particular implementation can define whatever parameters it wants.

Specified by:
configureMessageStore in interface MessageStore
Parameters:
name - The name to be used by this storem
recoveryHandler - Handler to be called as the store recovers on start up
config - The apache commons configuration object.
Throws:
Exception - If any error occurs that means the store is unable to configure itself.

close

public void close()
           throws Exception
Description copied from interface: MessageStore
Called to close and cleanup any resources used by the message store.

Specified by:
close in interface MessageStore
Throws:
Exception - If the close fails.

addMessage

public StoredMessage addMessage(StorableMessageMetaData metaData)
Specified by:
addMessage in interface MessageStore

createExchange

public void createExchange(Exchange exchange)
                    throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Makes the specified exchange persistent.

Specified by:
createExchange in interface DurableConfigurationStore
Parameters:
exchange - The exchange to persist.
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

removeExchange

public void removeExchange(Exchange exchange)
                    throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Removes the specified persistent exchange.

Specified by:
removeExchange in interface DurableConfigurationStore
Parameters:
exchange - The exchange to remove.
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

bindQueue

public void bindQueue(Exchange exchange,
                      org.apache.qpid.framing.AMQShortString routingKey,
                      AMQQueue queue,
                      org.apache.qpid.framing.FieldTable args)
               throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Binds the specified queue to an exchange with a routing key.

Specified by:
bindQueue in interface DurableConfigurationStore
Parameters:
exchange - The exchange to bind to.
routingKey - The routing key to bind by.
queue - The queue to bind.
args - Additional parameters.
Throws:
org.apache.qpid.AMQStoreException - if the operation fails for any reason.

unbindQueue

public void unbindQueue(Exchange exchange,
                        org.apache.qpid.framing.AMQShortString routingKey,
                        AMQQueue queue,
                        org.apache.qpid.framing.FieldTable args)
                 throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Unbinds the specified from an exchange under a particular routing key.

Specified by:
unbindQueue in interface DurableConfigurationStore
Parameters:
exchange - The exchange to unbind from.
routingKey - The routing key to unbind.
queue - The queue to unbind.
args - Additonal parameters.
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

createQueue

public void createQueue(AMQQueue queue)
                 throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Makes the specified queue persistent.

Specified by:
createQueue in interface DurableConfigurationStore
Parameters:
queue - The queue to store.
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

createQueue

public void createQueue(AMQQueue queue,
                        org.apache.qpid.framing.FieldTable arguments)
                 throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Makes the specified queue persistent.

Specified by:
createQueue in interface DurableConfigurationStore
Parameters:
queue - The queue to store.
arguments - The additional arguments to the binding
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

removeQueue

public void removeQueue(AMQQueue queue)
                 throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Removes the specified queue from the persistent store.

Specified by:
removeQueue in interface DurableConfigurationStore
Parameters:
queue - The queue to remove.
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

updateQueue

public void updateQueue(AMQQueue queue)
                 throws org.apache.qpid.AMQStoreException
Description copied from interface: DurableConfigurationStore
Updates the specified queue in the persistent store, IF it is already present. If the queue is not present in the store, it will not be added.

Specified by:
updateQueue in interface DurableConfigurationStore
Parameters:
queue - The queue to update the entry for.
Throws:
org.apache.qpid.AMQStoreException - If the operation fails for any reason.

configureTransactionLog

public void configureTransactionLog(String name,
                                    TransactionLogRecoveryHandler recoveryHandler,
                                    Configuration storeConfiguration,
                                    LogSubject logSubject)
                             throws Exception
Specified by:
configureTransactionLog in interface TransactionLog
Throws:
Exception

newTransaction

public TransactionLog.Transaction newTransaction()
Specified by:
newTransaction in interface TransactionLog

createQueues

public List<AMQQueue> createQueues()
                            throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

getNewMessageId

public Long getNewMessageId()

isPersistent

public boolean isPersistent()
Description copied from interface: MessageStore
Is this store capable of persisting the data

Specified by:
isPersistent in interface MessageStore
Returns:
true if this store is capable of persisting data


Licensed to the Apache Software Foundation