This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Configuring H2 In-memory Mode

To run the H2 database in-memory mode, you must do the following.

  1. Open the <MB_HOME>/repository/conf/datasources/master-datasources.xml file. This is where datasources are configured to point to the databases used by the Message Broker. This file consists of commented out configurations for datasources. The datasource configuration for H2 in-memory mode is among these. The changes made to this file must be done in both broker nodes.
  2. Uncomment or add the following configuration into the master-datasources.xml file.

    <datasource>
                <name>WSO2_MB_INMEMORY_MSG_STORE_DB</name>
                <jndiConfig>
                    <name>WSO2MBInMemoryStoreDB</name>
                </jndiConfig>
                <definition type="RDBMS">
                    <configuration>
                        <url>jdbc:h2:mem:store</url>
                        <driverClassName>org.h2.Driver</driverClassName>
                    </configuration>
                </definition>
    </datasource>

     

  3. Open the <MB_HOME>/repository/conf/broker.xml file. This is the root configuration file of Message Broker. The changes made to this file must be done in all the WSO2 Message Broker nodes.
  4. In the broker.xml file we need enable the In Memory message store and the In Memory Andes context store:

    1. Uncomment or add the following configurations:

      <!-- RDBMS Message Store configurations -->
      <messageStore class="org.wso2.andes.store.rdbms.h2.H2MemMessageStoreImpl">
      </messageStore>
      
      <!-- RDBMS Andes Context Store configurations -->
      <andesContextStore class="org.wso2.andes.store.rdbms.h2.H2MemAndesContextStoreImpl">
      </andesContextStore>
    2. Comment out the following configurations:

      <!-- RDBMS Message Store configurations -->
      <messageStore class="org.wso2.andes.store.rdbms.RDBMSMessageStoreImpl">
      </messageStore>
       
      <!-- RDBMS Andes Context Store configurations -->
      <contextStore class="org.wso2.andes.store.rdbms.RDBMSAndesContextStoreImpl">
      </contextStore>