Configure Sitecore roles for separate EventQueue, Properties, and Tasks tables

Abstract

How to configure Sitecore roles to use EventQueue, Properties, and Tasks tables in a database separate from their local Web database.

You can configure Sitecore roles to use EventQueue, Properties, and Tasks tables stored in a database separate from their local Web database. This can be necessary in several scenarios including when replicating the Web database using Azure active geo-replication.

To configure Sitecore roles for separate EventQueue, Properties, and Tasks tables:

  1. In the App_Config/ConnectionStrings.config file, add an additional connection string for the new database:

    <add name="<CONNECTION STRING NAME>" connectionString="Data Source=<HOSTNAME>;Initial Catalog=<DATABASE>;User ID=<USER>;Password=<PASSWORD>" />
  2. In the App_Config/Include/ folder, create a folder and name it, for example, MyPatchFiles/.

  3. In the App_Config/Include/MyPatchFiles/ folder, create a configuration patch file and name it, for example, DedicatedEventQueueProvider.config.

  4. In the DedicatedEventQueueProvider.config file, insert the following code and configure EventQueue to use the new database connection string by changing the param1 attribute:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <sitecore>
            <eventing defaultProvider="sitecore">
                <eventQueueProvider defaultEventQueue="core">
                    <eventQueue name="web" type="Sitecore.Data.Eventing.$(database)EventQueue, Sitecore.Kernel">
                        <param ref="dataApis/dataApi[@name='$(database)']" param1="<CONNECTION STRING NAME>" patch:instead="*[@param1='$(name)']"/>
                    </eventQueue>
                </eventQueueProvider>
            </eventing>
        </sitecore>
    </configuration>
  5. In the App_Config/Include/MyPatchFiles/ folder, create a configuration patch file and name it, for example, DedicatedPropertyStoreProvider.config.

  6. In the DedicatedPropertyStoreProvider.config file, insert the following code and configure PropertyStore to use the new database connection string by changing the param1 attribute:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <sitecore>
            <PropertyStoreProvider defaultStore="core">
                <store name="web" prefix="web" getValueWithoutPrefix="true" singleInstance="true" type="Sitecore.Data.Properties.$(database)PropertyStore, Sitecore.Kernel">
                <param ref="dataApis/dataApi[@name='$(database)']" param1="<CONNECTION STRING NAME>" patch:instead="*[@param1='$(name)']" />
                </store>
            </PropertyStoreProvider>
        </sitecore>
    </configuration>
  7. In the App_Config/Include/MyPatchFiles/ folder, create a configuration patch file and name it, for example, DedicatedTaskDatabase.config.

  8. In the DedicatedTaskDatabase.config file, insert the following code to configure TaskDatabase to use the new database connection string by changing the connectionStringName attribute:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <sitecore>
        <TaskDatabase>
          <param connectionStringName="<CONNECTION STRING NAME>" patch:instead="*[@connectionStringName='web']" />
        </TaskDatabase>
      </sitecore>
    </configuration>