public NacosNamingService(NamingConfig config, IHttpClientFactory httpClientFactory) { _config = config; _eventDispatcher = new EventDispatcher(); _namingProxy = new NamingProxy(config, new FastHttp(httpClientFactory, config)); _beatReactor = new BeatReactor(_namingProxy); _hostReactor = new HostReactor(_eventDispatcher, _namingProxy, config.CacheDir, config.LoadCacheAtStart); }
public HostReactor(EventDispatcher eventDispatcher, NamingProxy namingProxy, string cacheDir, bool loadCacheStart) { _eventDispatcher = eventDispatcher; _namingProxy = namingProxy; _cacheDir = cacheDir; if (loadCacheStart) { _serviceInfoMap = new Dictionary <string, ServiceInfo>(DiskCache.GetServiceInfos(_cacheDir)); } else { _serviceInfoMap = new Dictionary <string, ServiceInfo>(16); } _failoverReactor = new FailoverReactor(this, _cacheDir); }
/*private readonly PushReceiver _pushReceiver;*/ public HostReactor( ILoggerFactory loggerFactory, EventDispatcher eventDispatcher, NamingProxy proxy, NacosOptions options) { _logger = loggerFactory.CreateLogger <HostReactor>(); _eventDispatcher = eventDispatcher; _proxy = proxy; _options = options; // At this time, push receiver using udp way, it's not stable and nacos server // has limititation on different clients, c# was not support, so disable here. // _pushReceiver = new PushReceiver(loggerFactory, this); Task.Factory.StartNew( async() => await UpdateTask().ConfigureAwait(false)); }
public HostReactor(EventDispatcher eventDispatcher, NamingProxy namingProxy, string cacheDir) : this(eventDispatcher, namingProxy, cacheDir, false) { }
public BeatReactor(NamingProxy serverProxy) { _serverProxy = serverProxy; }
private BeatReactor CreateBeat() { var proxy = new NamingProxy(_config, new FastHttp(FakeHttpClientFactory.Create(_mockHttp.ToHttpClient()), _config)); return(new BeatReactor(proxy)); }