Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable server address resolver #408

Merged
merged 1 commit into from
Sep 10, 2018
Merged

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);
```
@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