Open, index, close in backend? Or keep client open?

I’m using Java.

Should I be keeping a client object open permanently (typically that’s not what I’d do with external clients)?

Or should I connect to via the Java API, do what I need to do, then close the client? This is usually a preferable approach for backend work.

Which leads to the second part of the question. How does one tell an APIClient object to disconnect?

Hi @steve1,

The client is designed to be long running (keep-alive, connection pool, etc.), so keep it open :slight_smile:

As of today there is no way to close the java api client. But it should be available, I’m opening an issue: https://github.com/algolia/algoliasearch-client-java-2/issues/357

Does this answer your question?

Best,

Thanks. Adding a way to close the client will help with testing and development. Currently, once the Java API has made at least one connection, it seems to prevent the JVM from cleanly shutting down.

As the client is designed to be long running, can I assume the client is “self-healing”? That is, it will automatically recover from intermittent connectivity problems?

All our API clients are designed to be very reliable, up to a certain point.
The client is “self-healing” means that even if a request fails the next one will be able to run.
On the other end, one specific request might fail after all the retries failed.