Example #1
0
 public PollingConsulDiscoverer(PollingConsulDiscovererOption option, ILogger <PollingConsulDiscoverer> logger, IDistributedCache <List <MicroService> > serviceCache, IConsulDiscoveryService consulDiscoveryService)
 {
     Option                 = option;
     Logger                 = logger;
     ServiceCache           = serviceCache;
     ConsulDiscoveryService = consulDiscoveryService;
 }
Example #2
0
        protected virtual IPollingConsulDiscoverer BuildPollingConsulDiscoverer(string service)
        {
            var option = new PollingConsulDiscovererOption()
            {
                Service         = service,
                PollingInterval = Options.PollingInterval,
                Prefix          = Options.Prefix,
                Expires         = Options.Expires
            };
            var logger        = ServiceProvider.GetService <ILogger <PollingConsulDiscoverer> >();
            var cache         = ServiceProvider.GetService <IDistributedCache <List <MicroService> > >();
            var consulService = ServiceProvider.GetService <IConsulDiscoveryService>();

            return(new PollingConsulDiscoverer(option, logger, cache, consulService));
        }