Skip to content

Commit 674300e

Browse files
committed
add http autorouting example
1 parent 7f0e8b2 commit 674300e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,29 +172,34 @@ Wrapping the injections in a callable will enforce lazy initialization.
172172

173173
### Clusters and routing
174174

175-
Cluster support is always available when directly connecting to the responsible servers. If you do not need to fine tune these connections, autorouting is available for bolt connections:
175+
Cluster support is always available when directly connecting to the responsible servers. If you do not need to fine tune these connections, autorouting is available for all connections:
176176

177177
```php
178178
use Laudis\Neo4j\Network\Bolt\BoltInjections;
179+
use Laudis\Neo4j\Network\Http\HttpInjections;
179180

180181
$client = Laudis\Neo4j\ClientBuilder::create()
181182
->addBoltConnection(
182183
'main',
183-
'http://neo4j:password@any-server-with-routing-information',
184+
'bolt://neo4j:password@any-server-with-routing-information',
184185
BoltInjections::create()->withAutoRouting(true)
185186
)
186-
->addBoltConnection('backup', 'http://neo4j:password@non-replicated-server')
187+
->addHttpConnection(
188+
'http',
189+
'http://neo4j:password@any-server-with-routing-information',
190+
HttpInjections::create()->withAutoRouting(true)
191+
)
192+
->addBoltConnection('backup', 'bolt://neo4j:password@non-replicated-server')
187193
->setDefaultConnection('main')
188194
->build();
189195

190196
$client->run('RETURN 1'); // will run over a random follower found in the routing table
191197
$client->run('MERGE (x:Y {z: 0)'); //will run over a random leader found in the routing table
192198
$client->run('RETURN 1', [], 'backup'); //will run over the non replicated server
193199
$client->run('RETURN 1', [], 'main'); //will be autorouted
200+
$client->run('RETURN 1', [], 'http'); //will be autorouted
194201
```
195202

196-
NOTE: http cluster support will be available in the next minor release and will have practically the same api.
197-
198203
## Final Remarks
199204

200205
### Filosophy

0 commit comments

Comments
 (0)