Exemple #1
0
        public ServiceDiscovery(string serviceName,
                                ReachabilityChecker reachabilityChecker,
                                IRemoteHostPoolFactory remoteHostPoolFactory,
                                IDiscoverySourceLoader discoverySourceLoader,
                                IEnvironmentVariableProvider environmentVariableProvider,
                                ISourceBlock <DiscoveryConfig> configListener,
                                Func <DiscoveryConfig> discoveryConfigFactory)
        {
            _serviceName           = serviceName;
            _originatingDeployment = new ServiceDeployment(serviceName, environmentVariableProvider.DeploymentEnvironment);
            _masterDeployment      = new ServiceDeployment(serviceName, MASTER_ENVIRONMENT);

            _reachabilityChecker   = reachabilityChecker;
            _remoteHostPoolFactory = remoteHostPoolFactory;
            _discoverySourceLoader = discoverySourceLoader;

            // Must be run in Task.Run() because of incorrect Orleans scheduling
            _initTask        = Task.Run(() => ReloadRemoteHost(discoveryConfigFactory()));
            _configBlockLink = configListener.LinkTo(new ActionBlock <DiscoveryConfig>(ReloadRemoteHost));
        }
Exemple #2
0
        public ServiceDiscovery(string serviceName,
                                ReachabilityChecker reachabilityChecker,
                                IRemoteHostPoolFactory remoteHostPoolFactory,
                                IDiscoverySourceLoader serviceDiscoveryLoader,
                                ISourceBlock <DiscoveryConfig> configListener,
                                Func <DiscoveryConfig> discoveryConfigFactory,
                                ILog log)
        {
            Log                    = log;
            _serviceName           = serviceName;
            _originatingDeployment = new DeploymentIdentifier(serviceName);
            _masterDeployment      = new DeploymentIdentifier(serviceName);

            _reachabilityChecker    = reachabilityChecker;
            _remoteHostPoolFactory  = remoteHostPoolFactory;
            _serviceDiscoveryLoader = serviceDiscoveryLoader;

            _initTask        = Task.Run(() => ReloadRemoteHost(discoveryConfigFactory()));
            _configBlockLink = configListener.LinkTo(new ActionBlock <DiscoveryConfig>(ReloadRemoteHost));
        }
        public ServiceDiscovery(string serviceName,
                                ReachabilityChecker reachabilityChecker,
                                IRemoteHostPoolFactory remoteHostPoolFactory,
                                IDiscoverySourceLoader serviceDiscoveryLoader,
                                IEnvironment environment,
                                ISourceBlock <DiscoveryConfig> configListener,
                                Func <DiscoveryConfig> discoveryConfigFactory,
                                ILog log)
        {
            Log                    = log;
            _serviceName           = serviceName;
            _originatingDeployment = new DeploymentIdentifier(serviceName, environment.DeploymentEnvironment, environment);

            _reachabilityChecker    = reachabilityChecker;
            _remoteHostPoolFactory  = remoteHostPoolFactory;
            _serviceDiscoveryLoader = serviceDiscoveryLoader;
            _environment            = environment;

            // Must be run in Task.Run() because of incorrect Orleans scheduling
            _initTask        = Task.Run(() => ReloadRemoteHost(discoveryConfigFactory()));
            _configBlockLink = configListener.LinkTo(new ActionBlock <DiscoveryConfig>(ReloadRemoteHost));
        }