Exemple #1
0
 private static ConsulClient CreateConsulClient(ConsulSettings settings) => new ConsulClient(config =>
 {
     config.Address    = settings.ListenerUrl;
     config.Datacenter = settings.Datacenter;
     config.Token      = settings.Token;
     config.WaitTime   = settings.WaitTime;
 });
 private static void ConfigureClient(ConsulClientConfiguration clientConfig, ConsulSettings settings)
 {
     clientConfig.Address    = settings.ListenerUrl;
     clientConfig.Datacenter = settings.Datacenter;
     clientConfig.Token      = settings.Token;
     clientConfig.WaitTime   = settings.WaitTime;
 }
Exemple #3
0
        public ConsulDiscoveryService(IConsulClient consulClient, ConsulSettings settings) : base(settings)
        {
            consul        = consulClient;
            this.settings = settings;

            var restartInterval = settings.RestartInterval;

            if (restartInterval.HasValue && restartInterval.Value != TimeSpan.Zero)
            {
                var scheduler = Context.System.Scheduler;
                restartTask = scheduler.ScheduleTellRepeatedlyCancelable(restartInterval.Value, restartInterval.Value,
                                                                         Self, RestartClient.Instance, Self);
            }
        }
Exemple #4
0
 public ConsulDiscoveryService(ConsulSettings settings)
     : this(CreateConsulClient(settings), settings)
 {
 }
 public ConsulDiscoveryService(IConsulClient consulClient, ConsulSettings settings) : base(settings)
 {
     consul        = consulClient;
     this.settings = settings;
 }
 public ConsulDiscoveryService(ConsulSettings settings)
     : this(new ConsulClient(config => ConfigureClient(config, settings)), settings)
 {
 }