Skip to content

JDBC Message Store

Introduction

Used for storing and retrieving messages more efficiently in comparison with other message stores. This is a variation of the already existing synapse message store implementation and is designed in a manner similar to the same message store. The JDBC message store uses a JDBC connector to connect to external relational databases.

To try this out quickly, see the JDBC Message Store example.

The advantages of using a JDBC message store instead of any other message store are as follows:

  • Easy to connect: You only need to have a JDBC connector to connect to an external relational database.
  • Quick transactions: JDBC message stores are capable of handling a large number of transactions per second.
  • Ability to work with a high capacity for a long period of time: Since JDBC stores use databases as the medium to store data, it can store a large volume of data and is capable of handling data for a longer period of time.

Properties

Listed below are the properties used for creating a JDBC Message Store.

Required Properties

The following properties are required when creating a JDBC Message Store.

Property Description
Name The name of the message store.
Database Table The name of the database table.
Driver The class name of the database driver.
URL The JDBC URL of the database that the data will be written to.
User The user name used to connect to the database.
Password The password used to connect to the database.

Connection Pool Properties

The syntax of the JDBC message store can be different depending on whether you connect to the database using a connection pool, or using a datasource. Given below are the connection pool properties:

Property Description
store.jdbc.driver The class name of the database driver.
store.jdbc.connection.url The database URL.
store.jdbc.username The user name to access the database.
store.jdbc.password The password to access the database.
store.jdbc.table Table name of the database.

External Datasource Properties

The syntax of the JDBC message store can be different depending on whether you connect to the database using a connection pool, or using a datasource. Given below are the external datasource properties:

Property Description
store.jdbc.dsName The name of the datasource to be looked up.
store.jdbc.table The table name of the database.

Internal Datasource Properties

To make sure that the datasource appears in the Datasource Name list, you need to expose it as a JNDI datasource.

Property Description
Name The name for the message store.
Database Table The name of the database table.
Datasource Name The class name of the datasource.