DeadLetters with Router/ActorSelection with remote routees

487 views
Skip to first unread message

Pierre Falda

unread,
Jul 11, 2014, 7:00:30 AM7/11/14
to akka...@googlegroups.com
Hi everyone,

I set up a little testing environment to debug another problem with remoting, but I'm stuck on an issue (?) with actorselection: telling a message to a remotely created router works, telling the message to an actorselectopn of that router, routes the message to deadletters.
Akka version: 2.3.3
(At the end of the mail, the application.conf)

My test code:

public class Main {

    public static void main(String[] args) throws InterruptedException {

        ActorSystem test_system = akka.actor.ActorSystem.create("PingActorSystem");

        test_system.eventStream().subscribe(test_system.actorOf(Props.create(EventWatcher.class)),Object.class);

        ActorRef router = test_system.actorOf(Props.create(LocalRouter.class).withRouter(new FromConfig()),"LocalRouter");

        ActorSelection router_selection = test_system.actorSelection("akka.tcp://PingAct...@192.168.2.17:2553/LocalRouter");

        Thread.sleep(1000);

        System.err.println(String.format("Selection ActorPath: %s AnchorPath: %s",router_selection.pathString(),router_selection.anchorPath()));

        router.tell(new Integer(1234),ActorRef.noSender());

        router_selection.tell("PING!?!?",ActorRef.noSender());

    }

}

The Output:

[INFO] [07/11/2014 12:35:43.352] [main] [Remoting] Starting remoting
[INFO] [07/11/2014 12:35:43.507] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://PingAct...@192.168.2.17:2553]
[INFO] [07/11/2014 12:35:43.508] [main] [Remoting] Remoting now listens on addresses: [akka.tcp://PingAct...@192.168.2.17:2553]
Received: akka.remote.AssociatedEvent
Selection ActorPath: /LocalRouter AnchorPath: akka://PingActorSystem/
Received: akka.actor.DeadLetter
java.lang.String
Received: akka.event.Logging$Info
[INFO] [07/11/2014 12:35:44.540] [PingActorSystem-akka.actor.default-dispatcher-4] [akka://PingActorSystem/LocalRouter] Message [java.lang.String] from Actor[akka://PingActorSystem/deadLetters] to Actor[akka://PingActorSystem/LocalRouter] was not delivered. [1] 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'.

The remote routees are successfully created and are not dead. I have no log at all on the worker/routees console (PongActorSystem), except for the receive of the numeric message.

Then I tried to ActorSelect the router from a third machine, but I have the same behaviour: message are correctly sent to the remote router (PingActoSystem), but instead
of forwarding it to the remotely deployed routees ( target {  nodes = ["akka.tcp://PongAct...@192.168.2.17:2552"] } ) it routes the message to deadletters.

Does anyone have ever had a similar issue? How could I fix?

Thanks in advance

- Pierre

Configuration:

akka {
  loglevel = "INFO"
  stdout-loglevel = "INFO"
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
    serialize-creators = on
    serialize-messages = on
    serializers {
      java = "akka.serialization.JavaSerializer"
      proto = "akka.remote.serialization.ProtobufSerializer"
    }

    serialization-bindings {
      "java.lang.String" = java
      "com.google.protobuf.Message" = proto
    }

    deployment {
      /LocalRouter {
        target {
          nodes = ["akka.tcp://PongAct...@192.168.2.17:2552"]
        }
        router = balancing-pool
        nr-of-instances = 1
      }

    }
    default-dispatcher {
      throughput = 10
      executor = "fork-join-executor"
    }
  }

  remote {
    enabled-transports = ["akka.remote.netty.tcp"]
    hostname = "Vortex"
    netty.tcp.port = 2553
  }

}

Martynas Mickevičius

unread,
Jul 11, 2014, 11:07:08 AM7/11/14
to akka...@googlegroups.com
Hi Pierre,

router itself is not an actor. It is an optimized ActorRef which sends messages directly to the routees. Therefore you can't select router with ActorSelection. However you can select individual children with ActorSelection which has names c1, c2, ...:

ActorSelection router_selection = test_system.actorSelection("akka.tcp://PingActorSystem@192.168.2.17:2553/LocalRouter/c1");

But that is not very useful.


--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Martynas Mickevičius
TypesafeReactive Apps on the JVM

Martynas Mickevičius

unread,
Jul 11, 2014, 12:18:08 PM7/11/14
to akka...@googlegroups.com
Also I just noticed an error in your configuration. Instead:

remote {
    enabled-transports = ["akka.remote.netty.tcp"]
    hostname = "Vortex"
    netty.tcp.port = 2553
}

it should be

remote {
    enabled-transports = ["akka.remote.netty.tcp"]
    netty.tcp {
        hostname = "Vortex"
        port = 2553
    }
}

Pierre Falda

unread,
Jul 11, 2014, 3:05:22 PM7/11/14
to akka...@googlegroups.com
Hi Martynas,

I think I found the problem reviewing some old code: I must specify /user in the actoselection path:

ActorSelection router_selection = test_system.actorSelection("akka.tcp://PingAct...@192.168.2.17:2553/user/LocalRouter");

Doing in this way works, but is this a bad pratice since (or at least is seems that) I'm actorselecting a remote router?



You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/L3WIkG6VZtk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Pierre Falda

unread,
Jul 14, 2014, 4:06:21 AM7/14/14
to akka...@googlegroups.com
Hi Martynas Mickevičius,

thank you, this fixed the connection problem with the hostname that I reported in the other thread! :-)

Pierre
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/L3WIkG6VZtk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


-- 
Pierre Falda
Technical Manager
DisBrain s.r.l.
www.disbrain.com
Reply all
Reply to author
Forward
0 new messages