Implementing Write-Behind Cache Event Handling

Synchronize your database with cache events by using a write-behind cache event handler.

This implementation requires a multi-site gateway hub configuration in your distributed system with the cache regions you need to handle configured to point to the hub. See Configuring a Multi-site (WAN) System.
  1. For each write-behind cache event handler you need, program an implementation of a GatewayEventListener, following the steps for implementing a cache event handler. See Implementing Cache Event Handlers.
  2. Configure your gateway hub so it has no incoming port specification (this is the default) and a single gateway with these settings:
    • No endpoints
    • Your gateway event listeners specified
    Example:
    <gateway-hub id="DBWriterHub" 
       <gateway id="DBWriter">
          <gateway-listener>
             <class-name>com.myApp.myWBCLListener</class-name>
          </gateway-listener>
       </gateway>
    </gateway-hub>

The gateway hub will pass events to the gateway’s listeners for the system where it is defined.