/// <summary> /// Registers all routes discovered by specified <see cref="IRoutingStrategy"/> in the RouteTable. /// </summary> /// <param name="strategy">A strategy that provides list of routes.</param> /// <param name="table">A table of DotVVM routes by specified name.</param> public static void AutoDiscoverRoutes(this DotvvmRouteTable table, IRoutingStrategy strategy) { foreach (var route in strategy.GetRoutes()) { table.Add(route.RouteName, route); } }
/// <summary> /// Registers all routes discovered by specified <see cref="IRoutingStrategy"/> in the RouteTable. /// </summary> /// <param name="strategy">A strategy that provides list of routes.</param> public static void AutoDiscoverRoutes(this DotvvmRouteTable table, IRoutingStrategy strategy) { foreach (var route in strategy.GetRoutes()) { table.Add(route.RouteName, route); } }
private void ReplaceStrategy(Node <IService> node, IRoutingStrategy <IService> strategy) { foreach (var child in node.ChildrenNodes) { child.Item2.Services.SetRoutingStrategy(strategy, _externalServicesOnly); ReplaceStrategy(child.Item2, strategy); } }
internal ServiceWatcher(string serviceName, HttpClient client, IRoutingStrategy <InformationServiceSet> routingStrategy, ILogger logger) { _serviceName = serviceName; _logger = logger; _routingStrategy = routingStrategy; _url = $"{HttpUtils.ServiceHealthUrl}{serviceName}?passing&index="; var ignore = WatcherLoop(client); }
private void ReplaceStrategy(Node <IService> node, IRoutingStrategy <IService> strategy) { foreach (var child in node.ChildrenNodes) { child.Value.Services.SetRoutingStrategy(strategy); ReplaceStrategy(child.Value, strategy); } }
protected internal Router(RouterSpecification specification, IRoutingStrategy routingStrategy) { for (int i = 0; i < specification.PoolSize; i++) { ChildActorFor(specification.RouterDefinition, specification.RouterProtocol); } this.routees = Routee.ForAll(LifeCycle.Environment.Children); this.routingStrategy = routingStrategy; }
public ServiceWatcher(string serviceName, HttpClient client, CancellationToken cancel, IRoutingStrategy <InformationServiceSet> routingStrategy) { _routingStrategy = routingStrategy; string lookupUrl = $"{HttpUtils.ServiceHealthUrl}{serviceName}"; #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed _watcher = new BlockingWatcher <List <InformationServiceSet> >(lookupUrl, client, cancel); _watcher.WatchLoop(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }
internal ServiceWatcher(string serviceName, HttpClient client, IRoutingStrategy <InformationServiceSet> routingStrategy, ILogger logger, bool useNearest) { _isNearest = useNearest; _serviceName = serviceName; _logger = logger; _routingStrategy = routingStrategy; _url = $"{HttpUtils.ServiceHealthUrl}{serviceName}?passing=true"; if (_isNearest) { _url += "&near=_agent"; } _url += "&index="; _logger?.LogInformation("Started watching service with name {serviceName}", _serviceName); var ignore = WatcherLoop(client); }
public void SetDefault(IRoutingStrategy <T> strategy) => Interlocked.Exchange(ref _default, strategy);
public void SetDefault(IRoutingStrategy <T> strategy) { Default = strategy; }
public void SetRoutingStrategy(IRoutingStrategy <T> routingStrategy) { _routingStrategy = routingStrategy; }
public ChildContainer(IDefaultRouting <T> defaultStrategy) { _routingStrategy = defaultStrategy.Default; }
public ServicesMonitorWatcher(string serviceName, IRoutingStrategy <ServiceInfo> routingStrategy, ConsulClient client, ILogger logger) : base(serviceName, client, logger, WatcherType.Services) { _routingStrategy = routingStrategy; }
/// <summary> /// Adds collection of routes defined by <see cref="IRoutingStrategy"/> to RouteTable. /// </summary> /// <param name="table"></param> /// <param name="strategy">Object that provides list of routes.</param> public static void RegisterRoutingStrategy(this DotvvmRouteTable table, IRoutingStrategy strategy) { var routes = new List <RouteInfo>(strategy.GetRoutes() ?? new List <RouteInfo>()); routes.ForEach(r => table.Add(r.RouteName, r.RouteUrl, r.VirtualPath, r.DefaultObject)); }