This post will explain about how Active MQ uses by default Kaha DB for message persistence.

Kaha DB is a file based persistence database that is messages are stored in file based data logs. When the messages in the data log have been consumed then data log is marked as deletable and after an interval, which is predetermined, the data log file is removed.

An index of message locations is cached in memory to facilitate quick retrieval of message data. At configurable checkpoint intervals, the references are inserted into the metadata store.

Main features of Kaha DB are as follows:

a. journal based storage so that messages can be written rapidly to the disk

b.full support for JMS transactions.

Active MQ is configured to use Kaha DB for message persistence and can be verified with the following:

In the activemq.xml, the following should be within the <broker>…</broker> tag


<kahaDB directory=”${}/kahadb” journalMaxFileLength=”1mb”/>


where journalMaxFileLength indicates the maximum length after which a new data log file will be created.

Some information about data logs, meta data cache and meta data store:

  1. Datalogs: Data logs are used to store data in the form of journals where all kinds of events – messages, acknowledgements, subscriptions are stored in a rolling log. New events are always appended to the end of the log. Hence the log file can be updated very rapidly.
  2. Metadata cache: metadata cache is an in memory cache consisting mainly of destinations and message references. For each JMS destination, the metadata cache holds a tree of message references, giving the location of every message in the data log files. Each message reference maps a message id to a particular offset in one of the data log files.
  3. Metadata store: The metadata store contains the metadata of the broker. The metadata store is written to a file called which is updated at predetermined intervals from the Meta data cache.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s