예제 #1
0
        protected EurekaDiscoveryClientBase(EurekaClientOptions clientOptions, EurekaInstanceOptions instOptions, IEurekaHttpClient httpClient, IApplicationLifetime lifeCycle = null, ILoggerFactory logFactory = null)
        {
            if (clientOptions == null)
            {
                throw new ArgumentNullException(nameof(clientOptions));
            }

            ClientConfig = clientOptions;
            InstConfig   = instOptions;

            if (InstConfig == null)
            {
                DiscoveryManager.Instance.Initialize(ClientConfig, httpClient, logFactory);
            }
            else
            {
                ConfigureInstanceIfNeeded(InstConfig);
                DiscoveryManager.Instance.Initialize(ClientConfig, InstConfig, httpClient, logFactory);
            }

            if (lifeCycle != null)
            {
                lifeCycle.ApplicationStopping.Register(() => { ShutdownAsync(); });
            }

            Client = DiscoveryManager.Instance.Client;
        }
예제 #2
0
        internal static void ConfigureDiscovery(IConfiguration config, DiscoveryOptions options, EurekaClientOptions clientOptions, EurekaInstanceOptions instOptions)
        {
            ConfigurationBinder.Bind(config, clientOptions);
            ConfigurationBinder.Bind(config, instOptions);

            options.ClientType          = DiscoveryClientType.EUREKA;
            options.ClientOptions       = clientOptions;
            options.RegistrationOptions = instOptions;
        }
예제 #3
0
 internal protected EurekaDiscoveryClient(EurekaClientOptions clientOptions, EurekaInstanceOptions instOptions, IApplicationLifetime lifeCycle = null, ILoggerFactory logFactory = null)
     : base(clientOptions, instOptions, null, lifeCycle, logFactory)
 {
 }