Akka Routing: Reply's send to router ends up as dead letters

前端 未结 1 2001
一生所求
一生所求 2021-01-20 20:04

I\'m playing around with Actor Routing and I can\'t send a reply back to the router so that another actor in the routing list can pick this up. I\'m using:

s         


        
相关标签:
1条回答
  • 2021-01-20 20:53

    Your problem is that your routees are not created by the router itself but by the Akka system with :

    system.actorOf(Props[Employee], "Penny")
    

    Therefore context.parent at the employee level will return the Akka system which will redirect your messages to the dead-letters mailbox.

    EDIT : According the documentation, see the section Routers, Routees and Senders which states explicitly

    Note that different code would be needed if the routees were 
    not children of the router, i.e. if they were provided when the router was created.
    

    This is exactly your situation, you are building your employees actors under the system actor and then you pass the ActorRef list as an argument of to the router's constructor.

    0 讨论(0)
提交回复
热议问题