[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439423#comment-16439423
 ] 

ASF GitHub Bot commented on CAMEL-12448:
----------------------------------------

player13 commented on a change in pull request #2296: CAMEL-12448  - 
camel-consul: filter health checks by service id
URL: https://github.com/apache/camel/pull/2296#discussion_r181729271
 
 

 ##########
 File path: 
components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
 ##########
 @@ -62,7 +62,12 @@ public ConsulServiceDiscovery(ConsulConfiguration 
configuration) throws Exceptio
             .getResponse();
 
         return services.stream()
-            .map(service -> newService(name, service, healths))
+            .map(service -> newService(
+                    name,
+                    service,
+                    healths.stream()
+                            .filter(serviceHealth -> 
serviceHealth.getService().getId().equals(service.getServiceId()))
+                            .collect(Collectors.toList())))
 
 Review comment:
   Done!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-12448
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12448
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-consul
>    Affects Versions: 2.21.0
>            Reporter: Vadim R
>            Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to