THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
public interface GatewayEventFailureListener extends CacheCallback { /** * Callback invoked on the GatewaySender when an event fails to be processed by the * GatewayReceiver * * @param event The event that failed * * @param exception The exception that occurred */ void onFailure(GatewayQueueEvent event, Throwable exception); } |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
public class LoggingGatewayEventFailureListener implements GatewayEventFailureListener, Declarable { private Cache cache; public void onFailure(GatewayQueueEvent event, Throwable exception) { this.cache.getLogger().warning("LoggingGatewayEventFailureListener onFailure: region=" + event.getRegion().getName() + "; operation=" + event.getOperation() + "; key=" + event.getKey() + "; value=" + event.getDeserializedValue() + "; exception=" + exception); } public void initialize(Cache cache, Properties properties) { this.cache = cache; } } |
...
Code Block | ||
---|---|---|
| ||
GatewaySender sender = cache.createGatewaySenderFactory() .setParallel(true) .setGatewayEventFailureListener(new FileGatewayEventFailureListener(new File(...))) .create("ln", 2); |
GatewayReceiver
The GatewayReceiverFactory adds the ability to set retry attempts and wait time between retry attempts:
...
gateway-sender
The create gateway-sender command command defines this new parameter:
...
Code Block |
---|
Cluster-1 gfsh>create gateway-sender --id=ln --parallel=true --remote-distributed-system-id=2 --gateway-event-failure-listener=LoggingGatewayEventFailureListener Member | Status ------ | ------------------------------------ ny-1 | GatewaySender "ln" created on "ny-1" |
gateway-receiver
The create gateway-receiver command defines these new parameters:
...
Code Block |
---|
<gateway-sender id="..."> <gateway-event-failure-listener> <class-name>FileGatewayEventFailureListener</class-name> </gateway-event-failure-listener> </gateway-sender> |
gateway-receiver
The <gateway-receiver> element defines the retry-attempts and wait-time-between-retry-attempts attributes.
...