Note: Documentation for Pivotal GemFire 7.0.x is now available at http://docs.gopivotal.com/gemfire/index.html. Please reference the docs.gopivotal.com site for the latest and most up-to-date documentation on GemFire 7.0.x. The vFabric GemFire 7.0 documentation site will no longer be updated.

Filtering Events for Multi-Site (WAN) Distribution

You can optionally create gateway sender and/or gateway receiver filters to control which events are queued and distributed to a remote site, or to modify the data stream that is transmitted between GemFire sites.

You can implement and deploy two different types of filter for multi-site events:

Configuring Multi-Site Event Filters

You install a GatewayEventFilter implementation to a configured gateway sender in order to decide which events are queued and distributed. You install a GatewayTransportFilter implementation to both a gateway sender and a gateway receiver to process the stream of batched events that are distributed between two sites:
  • XML example
    <cache>
      <gateway-sender id="remoteA" parallel="true" remote-distributed-system-id="1"> 
        <gateway-event-filter>
          <class-name>com.gemstone.gemfire.util.SampleEventFilter</class-name>
          <parameter name="param1">
            <string>"value1"</string>
          </parameter>
        </gateway-event-filter>
        <gateway-transport-filter>
          <class-name>com.gemstone.gemfire.util.SampleTransportFilter</class-name>
          <parameter name="param1">
            <string>"value1"</string>
          </parameter>
        </gateway-transport-filter>
      </gateway-sender> 
    </cache>
    <cache>
      ...
      <gateway-receiver start-port="1530" end-port="1551"> 
        <gateway-transport-filter>
          <class-name>com.gemstone.gemfire.util.SampleTransportFilter</class-name>
          <parameter name="param1">
            <string>"value1"</string>
          </parameter>
        </gateway-transport-filter>
      </gateway-receiver>
    </cache>
    
  • API example
    Cache cache = new CacheFactory().create();
    
    GatewayEventFilter efilter = new SampleEventFilter();
    GatewayTransportFilter tfilter = new SampleTransportFilter();
    
    GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
    gateway.setParallel(true);
    gateway.addGatewayEventFilter(efilter);
    gateway.addTransportFilter(tfilter);
    GatewaySender sender = gateway.create("remoteA", "1");
    sender.start();
    
    Cache cache = new CacheFactory().create();
    
    GatewayTransportFilter tfilter = new SampleTransportFilter();
    
    GatewayReceiverFactory gateway = cache.createGatewayReceiverFactory();
    gateway.setStartPort(1530);
    gateway.setEndPort(1551);
    gateway.addTransportFilter(tfilter);
    GatewayReceiver receiver = gateway.create();
    receiver.start();