Home » Akka Actor Reply Messages

Akka Actor Reply Messages

by Online Tutorials Library

Akka Actor Reply Messages

You can reply to a message by using sender() method. This method gives you ActorRef which is a instance of sender Actor. You can also store this reference. Replying to a message is simple, you just need to use sender() ! ReplyMsg.

If there is no sender i.e. a message which is sent without an actor or future context, the default sender is a ‘dead-letter’ actor reference.


Akka Actor Replying Message Example

Output:

Message recieved from deadLetters massage: Hello Message recieved from RootActor massage: Hello Child Replying to RootActor Message recieved from ActorChild massage: I got you message 

You may also like