The SDK supports either fully transparent or automatic failover in a number of situations.
When the SDK reconnects, entities obtained from the project are no longer valid. This includes publishers, subscribers, message readers/writers, and row readers/writers. After reconnecting, recreate these objects from the project.
In direct access mode, the SDK does not monitor the cluster for restarts. If a communication error occurs, the project object and all project-related entities are invalidated. Close the project, which also closes any elements it contains, then create a new project object and reconnect. The following example shows one way of doing this:
// encountered error
project.close(esperror);
project = server.get_project(workspace, pname, projoptions, esperror);
rc = project.connect(esperror);
// if the project has been successfully restarted this will succeed
if (!rc) {
// exit or loop
}
// create publisher or subscriber and proceed