public NacosNamingClient(
     ILoggerFactory loggerFactory
     , IOptionsMonitor <NacosOptions> optionAccs
     , IHttpClientFactory clientFactory)
 {
     _logger  = loggerFactory.CreateLogger <NacosNamingClient>();
     _options = optionAccs.CurrentValue;
     _proxy   = new Naming.Http.NamingProxy(loggerFactory, _options, clientFactory);
 }
 public BeatReactor(
     ILoggerFactory loggerFactory,
     Nacos.Naming.Http.NamingProxy proxy,
     NacosOptions optionAccs)
 {
     _logger  = loggerFactory.CreateLogger <BeatReactor>();
     _proxy   = proxy;
     _options = optionAccs;
 }
Beispiel #3
0
        public NacosNamingClient(
            ILoggerFactory loggerFactory
            , IOptionsMonitor <NacosOptions> optionAccs
            , IHttpClientFactory clientFactory)
        {
            this._logger        = loggerFactory.CreateLogger <NacosNamingClient>();
            this._options       = optionAccs.CurrentValue;
            this._clientFactory = clientFactory;

            this._serverAddressManager = new ServerAddressManager(_options);
        }
Beispiel #4
0
 public NacosNamingClient(
     ILoggerFactory loggerFactory,
     IOptionsMonitor <NacosOptions> optionAccs,
     IHttpClientFactory clientFactory)
 {
     _logger          = loggerFactory.CreateLogger <NacosNamingClient>();
     _options         = optionAccs.CurrentValue;
     _proxy           = new Naming.Http.NamingProxy(loggerFactory, _options, clientFactory);
     _beatReactor     = new BeatReactor(loggerFactory, _proxy, _options);
     _eventDispatcher = new EventDispatcher(loggerFactory);
     _hostReactor     = new HostReactor(loggerFactory, _eventDispatcher, _proxy, _options);
 }
Beispiel #5
0
        public NacosMsConfigClient(
            ILoggerFactory loggerFactory
            , NacosOptions options)
        {
            this._logger    = loggerFactory.CreateLogger <NacosConfigClient>();
            this._options   = options;
            this._processor = new MemoryLocalConfigInfoProcessor();
            this._client    = new NacosHttpClient();

            this.listeners             = new List <Listener>();
            this._serverAddressManager = new ServerAddressManager(_options);
        }
        public NacosConfigClient(
            ILoggerFactory loggerFactory
            , IOptionsMonitor <NacosOptions> optionAccs
            , IHttpClientFactory clientFactory
            , ILocalConfigInfoProcessor processor)
        {
            this._logger        = loggerFactory.CreateLogger <NacosConfigClient>();
            this._options       = optionAccs.CurrentValue;
            this._clientFactory = clientFactory;
            this._processor     = processor;

            this.listeners             = new List <Listener>();
            this._serverAddressManager = new ServerAddressManager(_options);
        }
Beispiel #7
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 #8
0
        public ServerAddressManager(NacosOptions options)
        {
            var serverAddresses = options.ServerAddresses;

            if (serverAddresses == null || !serverAddresses.Any())
            {
                throw new ArgumentNullException(" ServerAddresses can not be null or empty ");
            }

            foreach (var item in serverAddresses)
            {
                _servers.Add(item);
            }

            if (_servers.Count <= 0)
            {
                throw new Exceptions.NacosException("can not find out nacos server");
            }

            _server = _servers[0];
        }
        public ServerAddressManager(NacosOptions options)
        {
            var serverAddresses = options.ServerAddresses;

            if (serverAddresses == null || !serverAddresses.Any())
            {
                throw new ArgumentNullException($" ServerAddresses can not be null or empty ");
            }

            foreach (var item in serverAddresses)
            {
                string hostAndPort;

                var tmp = item.Split(':');

                switch (tmp.Length)
                {
                case 2:
                    hostAndPort = item;
                    break;

                case 1:
                    hostAndPort = $"{tmp[0]}";
                    break;

                default:
                    throw new ArgumentException(" incorrect server address, it should be [ip:port] ");
                }

                _servers.Add(hostAndPort);
            }

            if (_servers.Count <= 0)
            {
                throw new Exceptions.NacosException("can not find out nacos server");
            }

            _server = _servers[0];
        }
        public ServerAddressManager(NacosOptions options)
        {
            var serverAddresses = options.ServerAddresses;

            if (serverAddresses == null || !serverAddresses.Any())
            {
                throw new ArgumentNullException(" ServerAddresses can not be null or empty ");
            }

            foreach (var item in serverAddresses)
            {
                var hostAndPort = string.Empty;

                var tmp = item.Split(':');

                if (tmp.Length == 2)
                {
                    hostAndPort = item;
                }
                else if (tmp.Length == 1)
                {
                    hostAndPort = $"{tmp[0]}:8848";
                }
                else
                {
                    throw new ArgumentException(" incorrect server address, it should be [ip:port] ");
                }

                _servers.Add(hostAndPort);
            }

            if (_servers.Count <= 0)
            {
                throw new Exceptions.NacosException("can not find out nacos server");
            }

            _server = _servers[0];
        }