The BasicsThis is the default storage for AcitveMQ 5 and above. The AMQ Message Store is an embeddable transactional message storage solution that is extremely fast and reliable. Messages themselves are persisted in the data logs of the journal - with references to their location being held by a reference store (by default Kaha) for fast retrevial.
ConfigurationBy default ActiveMQ will use the the AMQ Store - and its default settings. You can configure the properties of the AMQ Store however, by explictly defining its persistence adapter (amqPersistenceAdapter): <broker brokerName="broker" persistent="true" useShutdownHook="false"> <persistenceAdapter> <amqPersistenceAdapter directory="${activemq.base}/activemq-data" maxFileLength="32mb"/> </persistenceAdapter> <transportConnectors> <transportConnector uri="tcp://localhost:61616"/> </transportConnectors> </broker> The above shows the configuration required to set the AMQ Store through its amqPersistenceAdapter - and explicity setting the directory and maxFileLength properties. AMQ Store Properties
Data StructureIn the data directory defined for the AMQ Store there is the following directory structure: Top levelthe message broker's name is used to distinguish its directory of message data. By default, the broker name is local host. archivemessage data logs are moved here when they are discarded. journalUsed to hold the message data logs kr-storeThe directory structure of the Kaha reference store (if used) dataThe indexes used to reference the message data logs in the journal for fast retrieval stateThe state of the store - i.e. names of durable subscribers - the reason for this is described in Recovery tmp-storageuse to hold data files for transient messages that may be stored on disk to alleviate memory consumption - e.g. non-persistent topic messages awaiting delivery to an active, but slow subscriber. RecoveryIf the message broker does not shutdown properly, then the reference store indexes are cleaned and the message data files (which contain messages/acknowledgements and transactional boundaries) are replayed to rebuild up the message store state. It is possbile to force automatic recovery if using the Kaha reference store (the default) by deleting the kr-store/state/ directory. |