akka Simple Actor DSL


Example

To create simple actors without creating a new class, you can use:

import akka.actor.ActorDSL._
import akka.actor.ActorSystem
 
implicit val system = ActorSystem("demo")

val a = actor(new Act {
  become {
    case "hello" ⇒ sender() ! "hi"
  }
})