Route() public method

public Route ( object message, IActorRef sender ) : void
message object
sender IActorRef
return void
Example #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);
     }
 }
Example #2
0
 public override void SendMessage(IActorRef sender, object message)
 {
     if (RouterConfig.IsManagementMessage(message))
     {
         base.SendMessage(sender, message);
     }
     else
     {
         Router.Route(message, sender);
     }
 }
Example #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);
     }
 }
Example #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);
                });
            }