public static IServiceCollection AddCondenser(this IServiceCollection self, string agentAddress, int agentPort, IHealthConfig health, IRoutingConfig routingConfig, IHttpClientConfig httpClientConfig) { var config = new CondenserConfiguration { AgentPort = agentPort, AgentAddress = agentAddress }; self.AddSingleton(config); self.AddSingleton(health); self.AddSingleton(routingConfig); self.AddSingleton(httpClientConfig); self.AddSingleton <RoutingData>(); self.AddSingleton <IService, HealthRouter>(); self.AddSingleton <IService, RouteSummary>(); self.AddSingleton <IService, TreeRouter>(); self.AddSingleton <IService, ChangeRoutingStrategy>(); self.AddSingleton <IService, ServerStatsRoute>(); self.AddTransient <IRoutingStrategy <IService>, RandomRoutingStrategy <IService> >(); self.AddTransient <IRoutingStrategy <IService>, RoundRobinRoutingStrategy <IService> >(); self.AddSingleton <IDefaultRouting <IService>, DefaultRouting <IService> >(); self.AddTransient <ChildContainer <IService> >(); self.AddSingleton <CurrentState>(); self.AddSingleton <CustomRouter>(); self.AddSingleton <RoutingHost>(); self.AddSingleton <RadixTree <IService> >(); self.AddTransient <Service>(); self.AddSingleton <Func <IConsulService> >(x => x.GetService <Service>); self.AddSingleton <Func <ChildContainer <IService> > >(x => x.GetService <ChildContainer <IService> >); return(self); }
public HealthRouter(IHealthConfig config, CurrentState stats) { _config = config; _state = stats; Routes = new[] { _config.Route }; }
public HealthStatsRouter(IHealthConfig config, IRouteStore store) { _config = config; Routes = new[] { _config.Route }; _store = store; }