Skip to content

Conversation

lutovich
Copy link
Contributor

This PR makes it possible to configure a resolver function used by the routing driver. Such function is used during the initial discovery and when all known routers have failed. Driver already had an internal facility like this which performed a DNS lookup in NodeJS environment for the hostname of the initial address. This remains the default. In browser environment no resolution is performed and address is used as-is. Users are now able to provide a custom resolver in the config.

Example:

var auth = neo4j.auth.basic('neo4j', 'neo4j');
var config = {
  resolver: function(address) {
    return ['fallback1.db.com:8987', 'fallback2.db.org:7687'];
  }
};
var driver = neo4j.driver('bolt+routing://db.com', auth, config);

This commit makes it possible to configure a resolver function used by
the routing driver. Such function is used during the initial discovery
and when all known routers have failed. Driver already had an internal
facility like this which performed a DNS lookup in NodeJS environment
for the hostname of the initial address. This remains the default. In
browser environment no resolution is performed and address is used
as-is. Users are now able to provide a custom resolver in the config.

Example:

```
var auth = neo4j.auth.basic('neo4j', 'neo4j');
var config = {
  resolver: function(address) {
    return ['fallback1.db.com:8987', 'fallback2.db.org:7687'];
  }
};
var driver = neo4j.driver('bolt+routing://db.com', auth, config);
```
@lutovich lutovich requested a review from zhenlineo September 10, 2018 14:05
@zhenlineo zhenlineo merged commit cf14dcc into neo4j:1.7 Sep 10, 2018
@lutovich lutovich deleted the 1.7-resolver branch September 10, 2018 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants