Introduce a method to create connection from multiple hosts. #562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a new static method
create_connection
inAbstractConnection
to create a connection providing multiple hosts.
The method takes an array of host arrays
with host,port,username,password and vhost keys
and tries to connect to them one-by-one.
The first successful connection is returned.
If unable to connect to any of them - the last esception is thrown.
This method is a simplest way to address issues like #253 or #498
There is no bookkeeping and load balancing, hosts are
selected one-by-one starting from the first one.
Combined with connection recovery techniques it can be used
to improve reliability when using clusters.