@Primary @Requires(property="micronaut.caches.discovery-client.enabled", notEquals="false") @Replaces(value=DefaultCompositeDiscoveryClient.class) public class CachingCompositeDiscoveryClient extends CompositeDiscoveryClient
DefaultCompositeDiscoveryClient
with one that caches the return
values.Constructor and Description |
---|
CachingCompositeDiscoveryClient(DiscoveryClient[] discoveryClients) |
Modifier and Type | Method and Description |
---|---|
io.reactivex.Flowable<List<ServiceInstance>> |
getInstances(String serviceId)
Obtain a list of
ServiceInstance for the given service id. |
io.reactivex.Flowable<List<String>> |
getServiceIds() |
close, getDescription, getDiscoveryClients, toString
public CachingCompositeDiscoveryClient(DiscoveryClient[] discoveryClients)
discoveryClients
- The discovery clients@Cacheable(value="discovery-client") public io.reactivex.Flowable<List<ServiceInstance>> getInstances(String serviceId)
DiscoveryClient
ServiceInstance
for the given service id.getInstances
in interface DiscoveryClient
getInstances
in class CompositeDiscoveryClient
serviceId
- The service idPublisher
that emits a list of ServiceInstance
@Cacheable(value="discovery-client") public io.reactivex.Flowable<List<String>> getServiceIds()
getServiceIds
in interface DiscoveryClient
getServiceIds
in class CompositeDiscoveryClient