public class HealthCheckServiceInstanceListSupplier extends DelegatingServiceInstanceListSupplier implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
ServiceInstanceListSupplier
implementation that verifies whether the
instances are alive and only returns the healthy one, unless there are none. Uses a
user-provided function to ping the health
endpoint of the instances.delegate
Constructor and Description |
---|
HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate,
LoadBalancerProperties.HealthCheck healthCheck,
BiFunction<ServiceInstance,String,reactor.core.publisher.Mono<Boolean>> aliveFunction) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
destroy() |
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) |
getDelegate, getServiceId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
builder, get
public HealthCheckServiceInstanceListSupplier(ServiceInstanceListSupplier delegate, LoadBalancerProperties.HealthCheck healthCheck, BiFunction<ServiceInstance,String,reactor.core.publisher.Mono<Boolean>> aliveFunction)
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class DelegatingServiceInstanceListSupplier
protected reactor.core.publisher.Flux<List<ServiceInstance>> healthCheckFlux(List<ServiceInstance> instances)
public reactor.core.publisher.Flux<List<ServiceInstance>> get()
get
in interface Supplier<reactor.core.publisher.Flux<List<ServiceInstance>>>
protected reactor.core.publisher.Mono<Boolean> isAlive(ServiceInstance serviceInstance)
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
destroy
in class DelegatingServiceInstanceListSupplier
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.