Connecting to remote Akka system: unable to connect.

78 views
Skip to first unread message

Ashesh Ambasta

unread,
Feb 17, 2015, 6:10:43 AM2/17/15
to play-fr...@googlegroups.com
I have an Akka system that is listening remotely with the following configuration:

akka {
  log
-dead-letters = 0
  actor
{
    provider
= "akka.remote.RemoteActorRefProvider"
 
}
  remote
{
    enabled
-transports = ["akka.remote.netty.tcp"]
    netty
.tcp {
      hostname
= "127.0.0.1"
      port
= 5000
   
}
 
}
}
redis
{
  hostname
= "localhost"
  port
= 6379
}

Quite straightforward. Surely, debugging this outputs:

[INFO] [02/17/2015 11:12:56.388] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://central...@127.0.0.1:5000]

Next, I have a Play! application (2.3.6) that should connect to this service. I have the following chunk of code in an action;

  Logger.info("Attempting to connect with Push")
  val selection
= Akka.system().actorSelection("akka.tcp://central...@127.0.0.1:5000")
  println
(selection)
  selection
! "hello"

Again, nothing fancy.

But no matter what I try, from the errors I get on Play!'s side, it seems like the actorSelection is attempting to select an actor from the default play Akka system:

[INFO] [02/17/2015 11:13:19.682] [application-akka.actor.default-dispatcher-2] [akka://application/deadLetters] Message [java.lang.String] from Actor[akka://application/deadLetters] to Actor[akka://application/deadLetters] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.

Also, on the Play! side, my build.sbt contains akka-remote:

name := "talk-to-remote-app"


version
:= "1.0"


lazy val
`talk-to-remote-app` = (project in file(".")).enablePlugins(PlayScala)


scalaVersion
:= "2.11.1"


libraryDependencies
++= Seq(
  jdbc
,
  javaJdbc
,
  javaEbean
,
 
"mysql" % "mysql-connector-java" % "5.1.27",
  anorm
,
  cache
,
  ws
,
 
"org.elasticsearch" % "elasticsearch" % "1.3.2",
 
"com.sksamuel.elastic4s" %% "elastic4s" % "1.3.2",
 
"com.typesafe.akka" %% "akka-remote" % "2.3.8",
 
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"
)


unmanagedResourceDirectories
in Test <+=  baseDirectory ( _ /"target/web/public/test" )  


Why is this? How can Play! connect to a remote Akka system?

Ashesh Ambasta

unread,
Feb 17, 2015, 7:09:27 AM2/17/15
to play-fr...@googlegroups.com
Bump. Anyone?


On Tuesday, 17 February 2015 12:10:43 UTC+1, Ashesh Ambasta wrote:
I have an Akka system that is listening remotely with the following configuration:

akka {
  log
-dead-letters = 0
  actor
{
    provider
= "akka.remote.RemoteActorRefProvider"
 
}
  remote
{
    enabled
-transports = ["akka.remote.netty.tcp"]
    netty
.tcp {
      hostname
= "127.0.0.1"
      port
= 5000
   
}
 
}
}
redis
{
  hostname
= "localhost"
  port
= 6379
}

Quite straightforward. Surely, debugging this outputs:

[INFO] [02/17/2015 11:12:56.388] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://centralapp-push@127.0.0.1:5000]

Next, I have a Play! application (2.3.6) that should connect to this service. I have the following chunk of code in an action;

  Logger.info("Attempting to connect with Push")

  val selection
= Akka.system().actorSelection("akka.tcp://centralapp-push@127.0.0.1:5000")
  println
(selection)
  selection
! "hello"

sachin walia

unread,
Feb 17, 2015, 2:06:46 PM2/17/15
to play-fr...@googlegroups.com
Do you have corresponding Akka remote config on play application.conf as well?

Yuji Fukui

unread,
Feb 17, 2015, 9:10:05 PM2/17/15
to play-fr...@googlegroups.com
"/user/ACTOR_NAME" may be necessary for the path.

actorSelection("akka.tcp://central...@127.0.0.1:5000/user/ACTOR_NAME")

http://doc.akka.io/docs/akka/snapshot/scala/remoting.html


2015年2月17日火曜日 20時10分43秒 UTC+9 Ashesh Ambasta:
I have an Akka system that is listening remotely with the following configuration:

akka {
  log
-dead-letters = 0
  actor
{
    provider
= "akka.remote.RemoteActorRefProvider"
 
}
  remote
{
    enabled
-transports = ["akka.remote.netty.tcp"]
    netty
.tcp {
      hostname
= "127.0.0.1"
      port
= 5000
   
}
 
}
}
redis
{
  hostname
= "localhost"
  port
= 6379
}

Quite straightforward. Surely, debugging this outputs:

[INFO] [02/17/2015 11:12:56.388] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://centralapp-push@127.0.0.1:5000]

Next, I have a Play! application (2.3.6) that should connect to this service. I have the following chunk of code in an action;

  Logger.info("Attempting to connect with Push")

  val selection
= Akka.system().actorSelection("akka.tcp://centralapp-push@127.0.0.1:5000")
  println
(selection)
  selection
! "hello"
Reply all
Reply to author
Forward
0 new messages