示例#1
0
        public virtual ILoadBalancer Create(LoadBalancerConfiguration configuration, [NotNull] string service)
        {
            var serviceDiscoveryProvider = ServiceProvider.GetRequiredService <IServiceDiscoveryProvider>();

            var noLoadBalancerConfiguration = configuration.GetNoLoadBalancerConfiguration();

            var noLoadBalancer = new NoLoadBalancer(service, noLoadBalancerConfiguration, serviceDiscoveryProvider);

            return(noLoadBalancer);
        }
示例#2
0
        public ILoadBalancer Create(LoadBalancerConfiguration configuration, [NotNull] string service)
        {
            var serviceDiscoveryProvider = ServiceProvider.GetRequiredService <IServiceDiscoveryProvider>();

            var randomLoadBalancerConfiguration = configuration.GetRandomConfiguration();

            var randomLoadBalancer = new RandomLoadBalancer(service, randomLoadBalancerConfiguration, serviceDiscoveryProvider);

            return(randomLoadBalancer);
        }
示例#3
0
        public static object GetConfiguration(
            [NotNull] this LoadBalancerConfiguration containerConfiguration,
            [NotNull] string name)
        {
            var value = containerConfiguration.GetConfigurationOrNull(name);

            if (value == null)
            {
                throw new AbpException($"Could not find the configuration value for '{name}'!");
            }

            return(value);
        }
示例#4
0
 public LoadBalancerConfiguration(LoadBalancerConfiguration fallbackConfiguration = null)
 {
     _fallbackConfiguration = fallbackConfiguration;
     _properties            = new Dictionary <string, object>();
 }
示例#5
0
 public static T GetConfiguration <T>(
     [NotNull] this LoadBalancerConfiguration containerConfiguration,
     [NotNull] string name)
 {
     return((T)containerConfiguration.GetConfiguration(name));
 }