This class contains logic used by a Router to route messages to one or more actors. These actors are known in the system as a Routee.
Example #1
0
 public Topic(TimeSpan emptyTimeToLive, RoutingLogic routingLogic) : base(emptyTimeToLive)
 {
     _routingLogic = routingLogic;
 }
 public DistributedPubSubSettings WithRoutingLogic(RoutingLogic routingLogic)
 {
     return new DistributedPubSubSettings(Role, routingLogic, GossipInterval, RemovedTimeToLive, MaxDeltaElements);
 }
        /// <summary>
        /// Creates a new instance of the <see cref="DistributedPubSubSettings"/>.
        /// </summary>
        public DistributedPubSubSettings(string role, RoutingLogic routingLogic, TimeSpan gossipInterval, TimeSpan removedTimeToLive, int maxDeltaElements)
        {
            if (routingLogic is ConsistentHashingRoutingLogic)
            {
                throw new ArgumentException("ConsistentHashingRoutingLogic cannot be used by the pub-sub mediator");
            }

            Role = !string.IsNullOrEmpty(role) ? role : null;
            RoutingLogic = routingLogic;
            GossipInterval = gossipInterval;
            RemovedTimeToLive = removedTimeToLive;
            MaxDeltaElements = maxDeltaElements;
        }
Example #4
0
 public Router(RoutingLogic logic, params Routee[] routees)
 {
     if (routees == null)
     {
         routees = new Routee[0];
     }
     this.routees = routees;
     this.logic = logic;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="DistributedPubSubSettings"/>.
 /// </summary>
 public DistributedPubSubSettings(string role, RoutingLogic routingLogic, TimeSpan gossipInterval, TimeSpan removedTimeToLive, int maxDeltaElements)
 {
     Role = !string.IsNullOrEmpty(role) ? role : null;
     RoutingLogic = routingLogic;
     GossipInterval = gossipInterval;
     RemovedTimeToLive = removedTimeToLive;
     MaxDeltaElements = maxDeltaElements;
 }
 public override Props RoutingLogicController(RoutingLogic routingLogic)
 {
     return Local.RoutingLogicController(routingLogic);
 }
Example #7
0
        //The signature might look funky. Why not just Router(RoutingLogic logic, params ActorRef[] routees) ? 
        //We need one unique constructor to handle this call: new Router(logic). The other constructor will handle that.
        //So in order to not confuse the compiler we demand at least one ActorRef. /@hcanber
        public Router(RoutingLogic logic, IActorRef routee, params IActorRef[] routees)
        {
            if (routees == null || routees.Length == 0)
            {
                _routees = new[] { Routee.FromActorRef(routee) };
            }
            else
            {
                var routeesLength = routees.Length;

                //Convert and put routee first in a new array
                var rts = new Routee[routeesLength + 1];
                rts[0] = Routee.FromActorRef(routee);

                //Convert all routees and put them into the new array
                for (var i = 0; i < routeesLength; i++)
                {
                    var actorRef = routees[i];
                    var r = Routee.FromActorRef(actorRef);
                    rts[i + 1] = r;
                }
                _routees = rts;
            }
            _logic = logic;
        }
Example #8
0
 public Topic(TimeSpan emptyTimeToLive, RoutingLogic routingLogic) : base(emptyTimeToLive)
 {
     _routingLogic = routingLogic;
     _buffer = new PerGroupingBuffer();
 }
Example #9
0
 /// <summary>
 /// Possibility to define an actor for controlling the routing
 /// logic from external stimuli(e.g.monitoring metrics).
 /// This actor will be a child of the router "head" actor.
 /// Management messages not handled by the "head" actor are
 /// delegated to this controller actor.
 /// </summary>
 public virtual Props RoutingLogicController(RoutingLogic routingLogic)
 {
     return(null);
 }
Example #10
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="logic">TBD</param>
 /// <param name="routees">TBD</param>
 public Router(RoutingLogic logic, params Routee[] routees)
 {
     _routees     = routees ?? Array.Empty <Routee>();
     RoutingLogic = logic;
 }