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

    Constructors
    Constructor
    Description
    CachingCompositeDiscoveryClient(io.micronaut.discovery.DiscoveryClient[] discoveryClients)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.reactivestreams.Publisher<List<io.micronaut.discovery.ServiceInstance>>
    getInstances(String serviceId)
     
    org.reactivestreams.Publisher<List<String>>
     

    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 interface io.micronaut.discovery.DiscoveryClient
      Overrides:
      getInstances in class io.micronaut.discovery.CompositeDiscoveryClient
    • getServiceIds

      @Cacheable("discovery-client") public org.reactivestreams.Publisher<List<String>> getServiceIds()
      Specified by:
      getServiceIds in interface io.micronaut.discovery.DiscoveryClient
      Overrides:
      getServiceIds in class io.micronaut.discovery.CompositeDiscoveryClient