[2.0]akka remote router deployment doesn't work

150 views
Skip to first unread message

Liu Js

unread,
Apr 9, 2012, 5:33:54 AM4/9/12
to akka...@googlegroups.com
I want to deploy a remote actor with a router, 
this is my config:
pingSys {
akka {
actor {
    provider = "akka.remote.RemoteActorRefProvider"
   
    deployment {
     /myPongActor {
       router = "round-robin"
       nr-of-instances = 5
       target {
         nodes = ["akka://pongS...@127.0.0.1:5555", "akka://pongS...@127.0.0.1:6666"]
       }
     }
   }
   }
   remote {
   transport = "akka.remote.netty.NettyRemoteTransport"
   netty {
     hostname = "127.0.0.1"
     port = 4444
   }
}
}     
}

This is my code:
final ActorSystem pingSys = ActorSystem.create("pingSystem",
ConfigFactory.load().getConfig("pingSys"));

ActorRef ping = pingSys.actorOf(new Props(PingActor.class),
"myPingActor");
ActorRef pong = pingSys.actorOf(new Props(PongActor.class),
"myPongActor");
ping.tell("run", pong);

However, the myPongActor is created locally.

This is the output log:
[INFO] [04/09/2012 17:33:05.560] [main] [ActorSystem(pingSystem)] REMOTE: RemoteServerStarted@akka://pingS...@127.0.0.1:4444
 akka://pingSystem/user/myPingActor say ping
 akka://pingSystem/user/myPongActor say pong
 akka://pingSystem/user/myPingActor say ping

What's the reason?

Viktor Klang

unread,
Apr 9, 2012, 7:17:52 AM4/9/12
to akka...@googlegroups.com
How do you know that it's not remote? Have you've enabled debug logging? Have youv'e made sure that the correct config gets loaded?

Cheers,
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/ko4RaJ5Nh2YJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Liu Js

unread,
Apr 9, 2012, 9:18:36 PM4/9/12
to akka...@googlegroups.com
I make sure it's not remote, because I debug the code, the ActorRef's type is LocalActorRef.
I make sure the configuration has been loaded, because some configuration have worked, such as the port.

I think some of my config is wrong, but I copy the config from akka's doc.

Can you give me some advice?
[INFO] [04/09/2012 17:33:05.560] [main] [ActorSystem(pingSystem)] REMOTE: RemoteServerStarted@akka://pingSy...@127.0.0.1:4444
 akka://pingSystem/user/myPingActor say ping
 akka://pingSystem/user/myPongActor say pong
 akka://pingSystem/user/myPingActor say ping

What's the reason?


How do you know that it's not remote? Have you've enabled debug logging? Have youv'e made sure that the correct config gets loaded?

Cheers,
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/ko4RaJ5Nh2YJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.

Roland Kuhn

unread,
Apr 15, 2012, 10:49:44 AM4/15/12
to akka...@googlegroups.com
Hi Liu,

a router must be declared in the code in order to enable that functionality, see http://doc.akka.io/docs/akka/2.0.1/scala/routing.html#How_Routing_is_Designed_within_Akka

So, in order to fix this, add .withRouter(FromConfig.getInstance()) to your Props (or “new FromConfig()”, which is the only way in 2.0).

Regards,

Roland

To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/72Wq5D55rccJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn


Shu Li Zheng

unread,
Mar 26, 2014, 11:24:51 AM3/26/14
to akka...@googlegroups.com
That fix my problem, very useful, thanks so much.

One suggestion, Could you add this part to routers with remote section? here just some config snippets, makes people confused.

在 2012年4月15日星期日UTC+8下午10时49分44秒,rkuhn写道:
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/72Wq5D55rccJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Reply all
Reply to author
Forward
0 new messages