Closed upwell closed 6 years ago
I found service discovery getRecord always return the first matched record while there were multiple service instance published with the same service name and type.
getRecord
I check the source code below.
https://github.com/vert-x3/vertx-service-discovery/blob/2e117cb28a1b76b02c8d65c3a10ac7cd1f3468c8/vertx-service-discovery/src/main/java/io/vertx/servicediscovery/impl/DiscoveryImpl.java#L367-L387
At L378, the findAny() method most likely return the first one.
findAny()
I wrote some test code. The findAny() method always returns the first element if in non-parallel pipline.
System.out.println(IntStream.range(0, 100).findAny().getAsInt()); System.out.println(IntStream.range(0, 100).findAny().getAsInt()); System.out.println(IntStream.range(0, 100).findAny().getAsInt()); System.out.println(IntStream.range(0, 100).findAny().getAsInt());
I googled and got some prove on stackoverflow about this behavior.
Please help check if this is by design or it's a bug.
I will answer your question on the user forum. Please do not cross post a question on GitHub.
I found service discovery
getRecord
always return the first matched record while there were multiple service instance published with the same service name and type.I check the source code below.
https://github.com/vert-x3/vertx-service-discovery/blob/2e117cb28a1b76b02c8d65c3a10ac7cd1f3468c8/vertx-service-discovery/src/main/java/io/vertx/servicediscovery/impl/DiscoveryImpl.java#L367-L387
At L378, the
findAny()
method most likely return the first one.I wrote some test code. The
findAny()
method always returns the first element if in non-parallel pipline.I googled and got some prove on stackoverflow about this behavior.
Please help check if this is by design or it's a bug.