Accepted answer

You can have some control over your mailbox using Stash:


Akka actors are event-driven. Whenever a message is ready for consumption from the actors mailbox, the partial function defined in receive in the actor is called with the message passed in.

In other words, "receive" is not an imperative construct, you cannot call it to wait for the next message. What you want is achievable via normal message passing. The requester actor sends the data to the worker actor, which executes the expensive operation, and then sends back the reply.

Related Query

More Query from same tag