Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-work connections and connection pool in favor of Node Pool (#2188)
This PR re-works Connection Pool, Connections and Strategies in favor of [Node Pool](https://github.com/elastic/elastic-transport-php#node-pool) from the official client. As this package is built on top of official client we have to use Node Pool instead of our custom connections mechanism. What makes the whole package a bit simplier to maintain. In the future this could be re-worked again if needed. We would liek to release new version of this package as fast as possible. ### ConnectionPool is replaced with Node Pool More details can be found via link: https://www.elastic.co/guide/en/elasticsearch/client/php-api/8.12/node_pool.html. By default Official elasticsearch client builds Simple Node Pool with `RoundRobin` selector and `NoResurrect` resurrect. To override default Node Pool behavior do the following: ```php use Elastic\Transport\NodePool\Resurrect\ElasticsearchResurrect; use Elastic\Transport\NodePool\Selector\RoundRobin; use Elastic\Transport\NodePool\SimpleNodePool; $nodePool = new SimpleNodePool( new RoundRobin(), new ElasticsearchResurrect() ); new Client([ 'hosts' => [ 'https://node1.com:9200', ], 'transport_config' => [ 'node_pool' => $nodePool, ], ]); ``` ### ClientConfiguration changes `ClientConfiguration` class is a bit reworked and the following parameters have been removed: - `port` - `path` - `url` - `connections` in favor of `hosts` - `servers` in favor of `hosts` - `roundRobin` `host` parameter has been renamed to `hosts` and it's should be an array of strings. `elastic/transport` is updated to 8.8 as since that version each host could be configured with its own username/password credentials. How to configure authentication per node. ```php new Client([ 'hosts' => [ 'https://username1:password1@node1.com:9200', 'https://username2:password2@node2.com:9200', ], ]); ``` ### No longer needed dependecies - `symfony/deprecation-contracts` - `guzzlehttp/psr7` - `nyholm/dsn`
- Loading branch information