Route() public method

public Route ( object message, IActorRef sender ) : void
message object
sender IActorRef
return void
Ejemplo n.º 1
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="envelope">TBD</param>
 public override void SendMessage(Envelope envelope)
 {
     if (RouterConfig.IsManagementMessage(envelope.Message))
     {
         base.SendMessage(envelope);
     }
     else
     {
         Router.Route(envelope.Message, envelope.Sender);
     }
 }
Ejemplo n.º 2
0
 public override void SendMessage(IActorRef sender, object message)
 {
     if (RouterConfig.IsManagementMessage(message))
     {
         base.SendMessage(sender, message);
     }
     else
     {
         Router.Route(message, sender);
     }
 }
Ejemplo n.º 3
0
 private void SendMessage(IActorRef sender, object message)
 {
     //Route the message via the router to the selected destination.
     if (_routerConfig.IsManagementMessage(message))
     {
         base.Post(sender, message);
     }
     else
     {
         _router.Route(message, sender);
     }
 }
Ejemplo n.º 4
0
            public RoundRobinLogicActor()
            {
                var n = 0;
                var router = new Router(new RoundRobinRoutingLogic());

                Receive<Props>(p =>
                {
                    n++;
                    var c = Context.ActorOf(p, "child-" + n);
                    Context.Watch(c);
                    router = router.AddRoutee(c);
                });

                Receive<Terminated>(terminated =>
                {
                    router = router.RemoveRoutee(terminated.ActorRef);
                    if (!router.Routees.Any())
                    {
                        Context.Stop(Self);
                    }
                });

                ReceiveAny(other =>
                {
                    router.Route(other, Sender);
                });
            }