Package io.micronaut.cache.discovery
Class CachingCompositeDiscoveryClient
java.lang.Object
io.micronaut.discovery.CompositeDiscoveryClient
io.micronaut.cache.discovery.CachingCompositeDiscoveryClient
- All Implemented Interfaces:
io.micronaut.core.naming.Described
,io.micronaut.discovery.DiscoveryClient
,Closeable
,AutoCloseable
@Primary
@Requires(beans=DiscoveryClientCacheConfiguration.class)
@Replaces(io.micronaut.discovery.DefaultCompositeDiscoveryClient.class)
public class CachingCompositeDiscoveryClient
extends io.micronaut.discovery.CompositeDiscoveryClient
Replaces the default
DefaultCompositeDiscoveryClient
with one that caches the return
values.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
ConstructorDescriptionCachingCompositeDiscoveryClient
(io.micronaut.discovery.DiscoveryClient[] discoveryClients) -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<List<io.micronaut.discovery.ServiceInstance>>
getInstances
(String serviceId) Methods inherited from class io.micronaut.discovery.CompositeDiscoveryClient
close, getDescription, getDiscoveryClients, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.core.naming.Described
getDescription
-
Constructor Details
-
CachingCompositeDiscoveryClient
public CachingCompositeDiscoveryClient(io.micronaut.discovery.DiscoveryClient[] discoveryClients) - Parameters:
discoveryClients
- The discovery clients
-
-
Method Details
-
getInstances
@Cacheable("discovery-client") public org.reactivestreams.Publisher<List<io.micronaut.discovery.ServiceInstance>> getInstances(String serviceId) - Specified by:
getInstances
in interfaceio.micronaut.discovery.DiscoveryClient
- Overrides:
getInstances
in classio.micronaut.discovery.CompositeDiscoveryClient
-
getServiceIds
- Specified by:
getServiceIds
in interfaceio.micronaut.discovery.DiscoveryClient
- Overrides:
getServiceIds
in classio.micronaut.discovery.CompositeDiscoveryClient
-