Mail Repository Store Configuration


Read documentation about persistence for a description of the Mail Repository Store functionality.

Consult mailrepositorystore.xml in GIT to get some examples and hints.

Mail Repository Stores are distinguished by where they store data. There are several types of storage: File, Database, Cassandra and DBFile.

File Repositories

File-based repositories store all data in the file system. In general, these repositories are extremely simple to configure, but may compare poorly in terms of performance when compared to other repository types. File repositories are not recommended for large or performance-critical configurations. In the default configuration, all repositories are file repositories.

File repository paths typically begin with the prefix "file". Paths are relative to the application base directory, unless the path begins with a slash. As an example, assume that James is running in /usr/james/phoenix/apps/james. Then "file://var/mail/spool/" would refer to the directory /usr/james/phoenix/apps/james/var/mail/spool. And "file:///var/mail/spool/" (note the extra '/') would refer to the directory /var/mail/spool.

All repository types (mail, spool, user, and news) have file-based implementations. No special configuration is required to enable file-based repositories

Database (JDBC) Repositories

These repositories store all message data in the database.

Database repositories store all data in an administrator-supplied database. Configuration is somewhat more complex, requiring that the administrator adjust the data-connections section. Detailed directions are included in the sample configuration file. The administrator will need to know the JDBC driver class, the appropriate URL for use with his database, and a valid username/password for the database.

If the administrator wants to configure a database other than MySQL, it will be necessary to add the jar or zip file containing the JDBC driver classes to the lib subdirectory of the installation directory. This will allow Apache James Server to properly load the driver when it is initializing the database repository.

Database repository paths typically begin with the prefix "db". The format is "db://<data-source>/<table>" where <data-source> is the name of the data-source defined in the data-connections section. And <table> is the particular table associated with the repository.

DBFile Repositories

These repositories store message delivery and headers in the DB, and the body to the filesystem.

This is a special repository type used only for mail repositories. DBFile repositories store the body of a mail message in the file system, while headers are stored in the database. This allows the administrator to minimize the size of data stored in the database, while conserving most of the performance of the database repository.


Cassandra Guice wiring allows to use the cassandra:// protocol for your ToRepository mailets.