Resolving WAN Errors

You can optionally create a GatewayEventErrorHandler implementation to respond to errors that occur when GemFire XD cannot apply a DML event that was delivered from another site over a WAN, or an event that could not be applied using a DBSynchronizer configuration.

GemFire XD logs events arriving from over WAN that failed to be applied to this distributed system in XML files. The XML files are named failed_gateway_dmls.xml and failed_gateway_dmls_entries.xml. The former is a root file and the latter contains the actual error entries. The XML files are created in the same directory as the system logs for each member on which the gateway receiver is running. The XML files can be used to replay the failed DML operations using the gfxd replay-failed-dmls command.

Implementing a GatewayEventErrorHandler

Note: A GatewayEventErrorHandler implementation is called for any errors that occur when applying DML updates received over a WAN or DBSynchronizer configuration.
  1. Program the event handler:
    1. Create a class that implements the GatewayEventErrorHandler interface.
    2. Implement the handler's onError() method to take some action in response to the error. onError() receives both the DML Event and the Exception that occurred. Event has methods for obtaining metadata about the old and new rows involved in the update, as well as other information associated with the event.
      package com.mypackage;
      import com.pivotal.gemfirexd.callbacks.GatewayEventErrorHandler;
      public class CustomEventErrorHandler implements GatewayEventErrorHandler {
        public void init(String params) {
        public void onError(Event event, Exception e) throws Exception {
          // Custom handling
  2. Install the error handler using the SYS.ATTACH_GATEWAY_ERROR_HANDLER procedure. For example:
    Connection conn = getConnection();
       CallableStatement cs = conn
            .prepareCall("CALL SYS.ATTACH_GATEWAY_ERROR_HANDLER(?,?)");
       cs.setString(1, "com.mypackage.CustomEventErrorHandler");
       cs.setString(2, "");