Skip to content

Routing context in URI #235

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

Merged
merged 5 commits into from
Apr 27, 2017
Merged

Routing context in URI #235

merged 5 commits into from
Apr 27, 2017

Conversation

lutovich
Copy link
Contributor

PR makes it possible to specify routing parameters in Bolt URI query.
These parameters are then send to server when doing rediscovery. This is true only for 3.2+ Neo4j database because it supports dbms.cluster.routing.getRoutingTable(context) procedure.

Example:
bolt+routing://localhost:7687/?policy=my_policy&region=china

@lutovich lutovich force-pushed the 1.3-routing-context branch 2 times, most recently from da6ea56 to 27303a1 Compare April 24, 2017 19:33
@zhenlineo
Copy link
Contributor

LG for the routing logic added.

Zhen and others added 5 commits April 25, 2017 16:26
Fixed parsing, comparison and added tests.
Move all URL parsing functions out of `connector` to `util` because they
are not really related to network connection and Bolt messages. Prohibit
invalid keys and values in routing context. Add tests for URL parsing.
Commit makes it possible to specify routing parameters in Bolt URI query.
These parameters are then send to server when doing rediscovery. This
is true only for 3.2+ Neo4j database because it supports
`getRoutingTable(context)` procedure.

Renamed `GetServersUtil` to `RoutingUtil` because it now knows about both
routing procedures `getServers` and `getRoutingTable`.
Connection exposes a promise resolved/rejected after INIT message.
This is done via `#initializationCompleted()` function. This commit
makes promise creation lazy because otherwise it results in
`UnhandledPromiseRejectionWarning` if noone calls
`#initializationCompleted()`.
return new RoutingDriver(parseUrl(url), routingContext, USER_AGENT, authToken, config);
} else if (scheme === 'bolt://') {
if (!isEmptyObjectOrNull(routingContext)) {
throw new Error(`Routing parameters are not supported with scheme 'bolt'. Given URL: '${url}'`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "Routing"

const connection = connect('bolt://localhost:7474'); // wrong port

connection.initializationCompleted().then(() => {
console.log('THEN called: ', arguments)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed

@lutovich lutovich merged commit 0946965 into neo4j:1.3 Apr 27, 2017
@lutovich lutovich deleted the 1.3-routing-context branch April 27, 2017 15:25
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