/// <summary> /// Creates Rules list from settings. /// </summary> private void CreateRuleList() { foreach (var routeInfoItem in _settings.Routes) { var rule = new RoutingRule { Name = routeInfoItem.Name, Filters = new RoutingFilter[routeInfoItem.Filters.Count], Destinations = new RoutingDestination[routeInfoItem.Destinations.Count], DistributionType = routeInfoItem.DistributionType }; for (var i = 0; i < rule.Filters.Length; i++) { rule.Filters[i] = new RoutingFilter { SourceServer = routeInfoItem.Filters[i].SourceServer, SourceApplication = routeInfoItem.Filters[i].SourceApplication, DestinationServer = routeInfoItem.Filters[i].DestinationServer, DestinationApplication = routeInfoItem.Filters[i].DestinationApplication, TransmitRule = routeInfoItem.Filters[i].TransmitRule }; if(rule.Filters[i].DestinationServer == "this") { rule.Filters[i].DestinationServer = MDSSettings.Instance.ThisServerName; } if (rule.Filters[i].DestinationServer == "this") { rule.Filters[i].DestinationServer = MDSSettings.Instance.ThisServerName; } } for (var i = 0; i < rule.Destinations.Length; i++) { rule.Destinations[i] = new RoutingDestination { Server = routeInfoItem.Destinations[i].Server, Application = routeInfoItem.Destinations[i].Application, RouteFactor = routeInfoItem.Destinations[i].RouteFactor }; } Rules.Add(rule); } }
/// <summary> /// Creates Rules list from settings. /// </summary> private void CreateRuleList() { foreach (var routeInfoItem in _settings.Routes) { var rule = new RoutingRule { Name = routeInfoItem.Name, Filters = new RoutingFilter[routeInfoItem.Filters.Count], Destinations = new RoutingDestination[routeInfoItem.Destinations.Count], DistributionType = routeInfoItem.DistributionType }; for (var i = 0; i < rule.Filters.Length; i++) { rule.Filters[i] = new RoutingFilter { SourceServer = routeInfoItem.Filters[i].SourceServer, SourceApplication = routeInfoItem.Filters[i].SourceApplication, DestinationServer = routeInfoItem.Filters[i].DestinationServer, DestinationApplication = routeInfoItem.Filters[i].DestinationApplication, TransmitRule = routeInfoItem.Filters[i].TransmitRule }; if (rule.Filters[i].DestinationServer == "this") { rule.Filters[i].DestinationServer = MDSSettings.Instance.ThisServerName; } if (rule.Filters[i].DestinationServer == "this") { rule.Filters[i].DestinationServer = MDSSettings.Instance.ThisServerName; } } for (var i = 0; i < rule.Destinations.Length; i++) { rule.Destinations[i] = new RoutingDestination { Server = routeInfoItem.Destinations[i].Server, Application = routeInfoItem.Destinations[i].Application, RouteFactor = routeInfoItem.Destinations[i].RouteFactor }; } Rules.Add(rule); } }
/// <summary> /// Creates a new RandomDistribution object. /// </summary> /// <param name="routingRule">Reference to RoutingRule object that uses this distribution strategy to route messages</param> public RandomDistribution(RoutingRule routingRule) : base(routingRule) { _rnd = new Random(); Reset(); }
/// <summary> /// Creates a new SequentialDistribution object. /// </summary> /// <param name="routingRule">Reference to RoutingRule object that uses this distribution strategy to route messages</param> public SequentialDistribution(RoutingRule routingRule) : base(routingRule) { Reset(); }
/// <summary> /// Constructor. /// </summary> /// <param name="routingRule">Reference to RoutingRule object that uses this distribution strategy to route messages</param> protected DistributionStrategyBase(RoutingRule routingRule) { RoutingRule = routingRule; }