Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }
Ejemplo n.º 3
0
 /// <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();
 }
Ejemplo n.º 4
0
 /// <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();
 }
Ejemplo n.º 5
0
 /// <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;
 }
Ejemplo n.º 6
0
 /// <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;
 }
Ejemplo n.º 8
0
 /// <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();
 }