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:

GatewayEventFilter. A GatewayEventFilter implementation determines whether a region event is placed in a gateway sender queue and/or whether an event in a gateway queue is distributed to a remote site. You can optionally add one or more GatewayEventFilter implementations to a gateway sender, etiher in the cache.xml configuration file or using the Java API.

GemFire makes a synchronous call to the filter’s beforeEnqueue method before it places a region event in the gateway sender queue. The filter returns a boolean value that specifies whether the event should be added to the queue.

For events that are distributed to another site, GemFire calls the listener’s afterAcknowledgement method to indicate that is has received an ack from the remote site after the event was received.

GatewayTransportFilter. Use a GatewayTransportFilter implementation to process the TCP stream that sends a batch of events that is distributed from one GemFire cluster to another over a WAN. A GatewayTransportFilter is typically used to perform encryption or compression on the data that distributed. You install the same GatewayTransportFilter implementation on both a gateway sender and gateway receiver.

When a gateway sender processes a batch of events for distribution, GemFire delivers the stream to the getInputStream method of a configured GatewayTransportFilter implementation. The filter processes and returns the stream, which is then transmitted to the gateway receiver. When the gateway receiver receives the batch, GemFire calls the getOutputStream method of a configured filter, which again processes and returns the stream so that the events can be applied in the local cluster.

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: