Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        /*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));
        }
Beispiel #4
0
 public HostReactor(EventDispatcher eventDispatcher, NamingProxy namingProxy, string cacheDir)
     : this(eventDispatcher, namingProxy, cacheDir, false)
 {
 }
Beispiel #5
0
 public BeatReactor(NamingProxy serverProxy)
 {
     _serverProxy = serverProxy;
 }
Beispiel #6
0
        private BeatReactor CreateBeat()
        {
            var proxy = new NamingProxy(_config, new FastHttp(FakeHttpClientFactory.Create(_mockHttp.ToHttpClient()), _config));

            return(new BeatReactor(proxy));
        }