Exemplo n.º 1
0
        protected override Routing ChooseRouteFor(IList <Routee> routees)
        {
            Routee least      = null;
            int    leastCount = int.MaxValue;

            foreach (var routee in routees)
            {
                var count = routee.PendingMessages;
                if (count == 0)
                {
                    least = routee;
                    break;
                }
                else if (count < leastCount)
                {
                    least      = routee;
                    leastCount = count;
                }
            }

            return(least == null?Routing.Empty() : Routing.With(least));
        }
Exemplo n.º 2
0
 /// <summary>
 /// See <see cref="Router{P}.ComputeRouting"/>
 /// </summary>
 protected internal override Routing <P> ComputeRouting() => Routing.With(Routees);
Exemplo n.º 3
0
        protected override Routing ChooseRouteFor(IList <Routee> routees)
        {
            var nextIndex = lastIndex++ % routees.Count;

            return(Routing.With(routees[nextIndex]));
        }
Exemplo n.º 4
0
 protected override Routing ChooseRouteFor(IList <Routee> routees)
 {
     return(Routing.With(routees));
 }
Exemplo n.º 5
0
 protected internal override Routing <P> ComputeRouting() => Routing.With(NextRoutee());
        protected override Routing ChooseRouteFor(IList <Routee> routees)
        {
            int index = random.Next(routees.Count);

            return(Routing.With(routees[index]));
        }