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

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, what am I not seeing here ;)

I'm using:

sender.tell([Message], context.parent)

to reply to the router as according to akka docs, routed actors set the sender to themselves and their parent is the actual router

when replying it will give the following message in the console:

[INFO] [12/13/2013 11:19:43.030] [StarBucks-akka.actor.default-dispatcher-2] [akka://StarBucks/deadLetters] Message [net.addictivesoftware.starbucks.MakeCoffee$] from Actor[akka://StarBucks/user/Melanie#-847662818] to Actor[akka://StarBucks/deadLetters] was not delivered. [1] dead letters encountered.

The main class is:

object Starbucks extends App { implicit val system = ActorSystem.create("StarBucks") val employees = List( system.actorOf(Props[Employee], "Penny"), system.actorOf(Props[Employee], "Leonard"), system.actorOf(Props[Employee], "Sheldon") ) val customers = List( ("Raj", "Tall Latte Machiato"), ("Howard", "Double Tall Cappuccino"), ("Bernadette", "Grande Spicy Pumpkin Latte"), ("Amy", "Dopio Espresso") ) val starBucks = system.actorOf( Props.empty.withRouter(SmallestMailboxRouter(routees=employees))) customers foreach { request => println("Customer %s orders a %s".format(request._1, request._2)) starBucks ! CanIHave(request._1, request._2) } }

The routed actor class is:

class Employee extends Actor { def receive = { case CanIHave(coffee, name) => { println("Employee %s writes '%s' and '%s' on a cup".format(self.path.name, coffee, name) ) sender.tell(MakeCoffee(coffee, name), context.parent) } case MakeCoffee(coffee, name) => { println("Employee %s makes a %s for %s ".format(self.path.name, coffee, name) ) sender.tell(CoffeeReady(coffee, name), context.parent) } case CoffeeReady(coffee, name) => { println("Employee %s shouts: %s for %s is ready!".format(self.path, name, coffee, name)) } } }


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.


  • Meteor - Google Maps InfoWindow Event Not Firing
  • Analytics for cross platform JavaScript based mobile app [duplicate]
  • JAVA - set font of selectedtext in a JEditorPane
  • Cannot add a row to Google Spreadsheet
  • Grails Packaging and Naming Conventions
  • c#.NET USB device persistent identifier
  • Why is this code not working? Hangman
  • How to use ctype_alpha with UTF-8
  • cannot be assigned to — it is read only - C#
  • Encoding: everything is UTF-8 but the DB output is displayed wrong. Any Ideas?
  • Apple Mach - O Linker Error.No such file or directory Swifty Json
  • substitute period from abbreviation (single letter + period) unless followed by a capital letter
  • Ruby regex to remove all consecutive letters from string
  • Add spaces between words in spaceless string
  • QPushButton is not changing the background-color proper
  • Layout design help Android
  • Hibernate to update table schema
  • How to disable all widgets inside Panel or inside Composite?
  • how to avoid repetitive constructor in children
  • Highlight and Bold text in JTextPane
  • how to do an event when i swipe from fragment to the other
  • Why value captured by reference in lambda is broken? [duplicate]
  • Is calc() supported in html email?
  • req.body is undefined - nodejs
  • Possible to stop flickering java tooltip in heavyweight mode?
  • output of program is not same as passed argument
  • Running a C# exe file
  • Symfony2: How to get request parameter
  • Akka Routing: Reply's send to router ends up as dead letters
  • Numpy divide by zero. Why?
  • AT Commands to Send SMS not working in Windows 8.1
  • Is there a mandatory requirement to switch app.yaml?
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How do I configure my settings file to work with unit tests?
  • Java static initializers and reflection
  • Is it possible to post an object from jquery to bottle.py?
  • unknown Exception android
  • Checking variable from a different class in C#
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app