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 communication error esp_project_close(project, error); project = esp_project_get(uri, creds, NULL, error); rc = esp_project_connect(project, error); // if the project has been successfully restarted this will succeed if (!rc) { // exit or loop } // create publisher or subscriber and proceed