ntext, PingCommand(message, replyTo)) =&gt;
      context.log.info(s&quot;Receive ping message: $message&quot;)
      replyTo ! Ping.PongCommand(s&quot;Hello $message&quot;)
      Behaviors.stopped
  }
}</code></pre>
<p>运行actor需要有一个ActorSystem，这面的代码将执行这个示例。</p>
<pre class="prettyprint"><a class="icon go-to-source" href="https://github.com/yangbajing/akka-cookbook/tree/master/cookbook-actor/src/main/scala/cookbook/actor/introduction/HelloWorld.scala#L56-L58" target="