public static async Task <IEnhancedOrgService> GetSelfBalancingService(ServiceParams parameters, IReadOnlyCollection <IServicePool <IOrganizationService> > pools, RouterRules rules = null) { parameters.Require(nameof(parameters)); pools.Require(nameof(pools)); if (AutoSetMaxPerformanceParams) { parameters.AutoSetMaxPerformanceParams(); } var routingService = new RoutingService <IOrganizationService>(); foreach (var pool in pools) { routingService.AddNode(pool); } if (rules != null) { routingService.DefineRules(rules); } await routingService.StartRouter(); var routingPool = new RoutingPool <IOrganizationService>(routingService); return(new EnhancedServiceFactory <IEnhancedOrgService, Services.Enhanced.EnhancedOrgService>(parameters) .CreateService(routingPool)); }
public static ISelfBalancingOrgService GetSelfBalancingService(IEnumerable <EnhancedServiceParams> nodeParameters, RouterRules rules) { var routingService = new RoutingService(); foreach (var parameters in nodeParameters) { routingService.AddNode(parameters); } routingService.DefineRules(rules); routingService.StartRouter(); return(new EnhancedServiceFactory <ISelfBalancingOrgService, SelfBalancingOrgService>(routingService).CreateEnhancedService()); }