neo4j-php-client
neo4j-php-client copied to clipboard
Implement a connection resolver
Is your feature request related to a problem? Please describe. When working in a high availability environment, it is custom to introduce multiple A or AAAA records for the same address, so the client can try different servers in the case a single one goes down. In the current implementation, it is impossible to do that, as it requests a single IP for a hostname.
Describe the solution you'd like
We should abstract the problem away in a Connection Resolver class, which uses dns_get_record
to iterate over all possible solutions when verifying connectivity before fetching the routing table. Once the routing table has been fetched, everything can resume as normal.
Describe alternatives you've considered
The only real alternative is to create multiple drivers directly pointing to every IP address and pointing to each server instance and using verifyConnectivity
on each driver to decide which one can fetch the routing table
Additional context https://www.php.net/manual/en/function.dns-get-record.php