Class HealthCheckServiceInstanceListSupplier
- java.lang.Object
-
- org.springframework.cloud.loadbalancer.core.DelegatingServiceInstanceListSupplier
-
- org.springframework.cloud.loadbalancer.core.HealthCheckServiceInstanceListSupplier
-
- All Implemented Interfaces:
Supplier<reactor.core.publisher.Flux<List<ServiceInstance>>>,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,ServiceInstanceListSupplier
public class HealthCheckServiceInstanceListSupplier extends DelegatingServiceInstanceListSupplier implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
AServiceInstanceListSupplierimplementation that verifies whether the instances are alive and only returns the healthy one, unless there are none. Uses a user-provided function to ping thehealthendpoint of the instances.- Since:
- 2.2.0
- Author:
- Olga Maciaszek-Sharma, Roman Matiushchenko, Roman Chigvintsev
-
-
Field Summary
-
Fields inherited from class org.springframework.cloud.loadbalancer.core.DelegatingServiceInstanceListSupplier
delegate
-
-
Constructor Summary
Constructors Constructor Description HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate, LoadBalancerProperties.HealthCheck healthCheck, BiFunction<ServiceInstance,String,reactor.core.publisher.Mono<Boolean>> aliveFunction)HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate, ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory, BiFunction<ServiceInstance,String,reactor.core.publisher.Mono<Boolean>> aliveFunction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voiddestroy()reactor.core.publisher.Flux<List<ServiceInstance>>get()protected reactor.core.publisher.Flux<List<ServiceInstance>>healthCheckFlux(List<ServiceInstance> instances)protected reactor.core.publisher.Mono<Boolean>isAlive(ServiceInstance serviceInstance)-
Methods inherited from class org.springframework.cloud.loadbalancer.core.DelegatingServiceInstanceListSupplier
getDelegate, getServiceId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier
get
-
-
-
-
Constructor Detail
-
HealthCheckServiceInstanceListSupplier
@Deprecated public HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate, LoadBalancerProperties.HealthCheck healthCheck, BiFunction<ServiceInstance,String,reactor.core.publisher.Mono<Boolean>> aliveFunction)
-
HealthCheckServiceInstanceListSupplier
public HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate, ReactiveLoadBalancer.Factory<ServiceInstance> loadBalancerClientFactory, BiFunction<ServiceInstance,String,reactor.core.publisher.Mono<Boolean>> aliveFunction)
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classDelegatingServiceInstanceListSupplier
-
healthCheckFlux
protected reactor.core.publisher.Flux<List<ServiceInstance>> healthCheckFlux(List<ServiceInstance> instances)
-
get
public reactor.core.publisher.Flux<List<ServiceInstance>> get()
- Specified by:
getin interfaceSupplier<reactor.core.publisher.Flux<List<ServiceInstance>>>
-
isAlive
protected reactor.core.publisher.Mono<Boolean> isAlive(ServiceInstance serviceInstance)
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Overrides:
destroyin classDelegatingServiceInstanceListSupplier
-
-