Author Topic: Using ConfServiceFactory with Warm Standby  (Read 2625 times)

Offline illusion

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Using ConfServiceFactory with Warm Standby
« on: November 09, 2016, 06:57:36 AM »
Hi guys

I'm utilizing the SDK to pull information from ConfServerProtocol and I've run into a little pickle. I'm having trouble getting the DbAccess information.

I'm using a warm standby type connection to the server and as a result my Endloints reside on the Warm Standby code (setEndpoints) and thus when I attempt to createConfService it throws an exception due to the protocol not containing any endpoints.

Is there a way around this at all? I've tried creating the Service post opening of the protocol but it needs to be created pre opening

Any ideas? I'm using Java as well

Cheers!

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Using ConfServiceFactory with Warm Standby
« Reply #1 on: November 09, 2016, 08:30:32 AM »
Hi,

I normally do something like this:

[code]
private void createConfigConnection() {
try {
log.debug("Start of Config Connection.");

// Implement ADDP
PropertyConfiguration options = new PropertyConfiguration();
options.setUseAddp(true);
options.setAddpClientTimeout(3);
options.setAddpServerTimeout(4);
options.setAddpTraceMode(AddpTraceMode.Local);

// Create primary and backup endpoints.

List<Endpoint> endpoints = new LinkedList<Endpoint>();
endpoints.add(new Endpoint("demosrv", 3333, options));
endpoints.add(new Endpoint("demosrv", 20201, options));

//Create the protocol, set the endpoint to one of the above endpoints.
protocol = new ConfServerProtocol();
//Set name of type of Client
protocol.setClientName("MyAppName");
protocol.setClientApplicationType(CfgAppType.CFGThirdPartyServer.ordinal());
protocol.setEndpoint(endpoints.get(0));

//Create the Warm Standby Config
WSConfig wsconfig = new WSConfig();
wsconfig.setEndpoints(endpoints);

//Create the WarmStandy object
WarmStandby warmStandby = new WarmStandby(protocol);
warmStandby.setConfig(wsconfig);
warmStandby.setHandler(this);

this.wsEnabledClient = warmStandby;

//Create the ConfService
service = ConfServiceFactory.createConfService(protocol);
singleThreadInvoker = new SingleThreadInvoker();
service.setInvoker(singleThreadInvoker);

//Start to try to connect, if we connect and then get disconnected it will still try to connect.
wsEnabledClient.autoRestore();

} catch (Exception e) {
log.error("Error Connecting to Config Server", e);
}

}
[/code]