Exemplo n.º 1
0
        /// <inheritdoc />
        public ConsulNodeSourceFactory(ILog log, ConsulClient consulClient, Func <DeploymentIdentifier,
                                                                                  ConsulNodeSource> createConsulNodeSource, IDateTime dateTime, Func <ConsulConfig> getConfig, IHealthMonitor healthMonitor)
        {
            Log                    = log;
            ConsulClient           = consulClient;
            CreateConsulNodeSource = createConsulNodeSource;
            DateTime               = dateTime;
            GetConfig              = getConfig;

            _serviceListHealthMonitor = healthMonitor.SetHealthFunction("ConsulServiceList", () => new ValueTask <HealthCheckResult>(_healthStatus)); // nest under "Consul" along with other consul-related healths.
            Task.Run(() => GetAllLoop());
        }
Exemplo n.º 2
0
 public LoadBalancer(
     IDiscovery discovery,
     DeploymentIdentifier deploymentIdentifier,
     ReachabilityCheck reachabilityCheck,
     TrafficRoutingStrategy trafficRoutingStrategy,
     Func <Node, DeploymentIdentifier, ReachabilityCheck, Action, NodeMonitoringState> createNodeMonitoringState,
     IHealthMonitor healthMonitor,
     IDateTime dateTime,
     ILog log)
 {
     DeploymentIdentifier      = deploymentIdentifier;
     Discovery                 = discovery;
     ReachabilityCheck         = reachabilityCheck;
     TrafficRoutingStrategy    = trafficRoutingStrategy;
     CreateNodeMonitoringState = createNodeMonitoringState;
     DateTime       = dateTime;
     Log            = log;
     _healthMonitor = healthMonitor.SetHealthFunction(DeploymentIdentifier.ToString(), () => new ValueTask <HealthCheckResult>(_healthStatus));
 }