public interface WarmStandbyConnectionFailureHandler
WarmStandbyConnectionFailureHandler
interface and then configuring the WarmStandbyService
instance to use it. The
WarmStandbyService
will call the custom implementation and provide failure
context, so the user can specify whether to schedule the next reconnect task,
switchover, or stop the service.
Here are some samples of the handler implementation:
class MyDummyFailureHandler
implements WarmStandbyConnectionFailureHandler {
public boolean handleRegistrationFailure(
WarmStandbyConnectionFailureContext context) {
System.out.println(RegistrationFailure);
return false;
}
public boolean handleConnectionFailure(
WarmStandbyConnectionFailureContext context) {
System.out.println(ConnectionFailure);
return false;
}
}
class MyDefaultFailureHandler
implements WarmStandbyConnectionFailureHandler {
public boolean handleRegistrationFailure(
WarmStandbyConnectionFailureContext context) {
context.doStandbyOff();
return true;
}
public boolean handleConnectionFailure(
WarmStandbyConnectionFailureContext context) {
WarmStandbyService service = context.getService();
WarmStandbyConfiguration config =
service.getConfiguration();
if (service.getAttempt() > config.getAttempts()) {
Short cfgSwitchovers = config.getSwitchovers();
if (cfgSwitchovers == null
|| service.getSwitchover() < cfgSwitchovers) {
context.doSwitchover();
} else {
if (log.isDebug()) {
log.debug("Switchover "
+ service.getSwitchover()
+ " of " + cfgSwitchovers
+ ", WarmStandbyService is stopped");
}
context.doStandbyOff();
return true;
}
}
context.scheduleReconnect(config.getTimeout());
return true;
}
}
WarmStandbyConfiguration
object for Genesys Configuration
Server with an unavailable active server and with the wrong initial value
for user password.
In this scenario, we can create custom handler which performs fast switchover
on connection failure, corrects the password on registration failure, and
initiates a reconnect with the new password:
final ConfServerProtocol cfgProtocol =
new ConfServerProtocol(confEPBad1);
cfgProtocol.setClientName("default");
cfgProtocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal());
cfgProtocol.setUserName("default");
cfgProtocol.setUserPassword("<wrong-pass>");
cfgProtocol.setTimeout(2000);
WarmStandbyConnectionFailureHandler handler =
new WarmStandbyConnectionFailureHandler() {
public boolean handleRegistrationFailure(
WarmStandbyConnectionFailureContext context) {
System.out.println("handleRegistrationFailure");
((ConfServerProtocol) context.getService().getChannel())
.setUserPassword("<good-password>");
context.scheduleReconnect(100);
return true;
}
public boolean handleConnectionFailure(
WarmStandbyConnectionFailureContext context) {
System.out.println("handleConnectionFailure");
context.doSwitchover();
context.scheduleReconnect(100);
return true;
}
};
WarmStandbyService service = new WarmStandbyService(cfgProtocol);
WarmStandbyConfiguration config = new WarmStandbyConfiguration(
confEPBad1, confEPGood1,
1000, (short) 2, (short) 3);
service.applyConfiguration(config);
service.setConnectionFailureHandler(handler);
service.start();
cfgProtocol.beginOpen();
Modifier and Type | Method | Description |
---|---|---|
boolean |
handleConnectionFailure(WarmStandbyConnectionFailureContext context) |
This call-back method is called in case of connection failure
(except RegistrationException).
|
boolean |
handleRegistrationFailure(WarmStandbyConnectionFailureContext context) |
This call-back method is called in case of RegistrationException.
|
boolean handleRegistrationFailure(WarmStandbyConnectionFailureContext context)
context
- failure contextRegistrationException
boolean handleConnectionFailure(WarmStandbyConnectionFailureContext context)
context
- failure contextSend comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.