添加到Akka的配置文件

时间:2012-07-13 22:55:23

标签: scala config dispatcher akka

我的环境是eclipse indigo,我正在尝试添加自定义调度程序。

import akka.actor.Actor
import akka.actor.ActorRef
import akka.dispatch.MessageDispatcher
import akka.dispatch._
import akka.event.Logging
import akka.actor.ActorSystem
import akka.actor.Props
import akka.dispatch;

class MyActor extends Actor {
    Console.println("World!");
    val log = Logging(context.system, this)
    def receive = {
        case "test" => log.info("received test")
        case _      => log.info("received unknown message")
    }
}  

object Main extends App {    

    val system = ActorSystem("MySystem")
        Console.println("Hello");
    val myActor = system.actorOf(Props[MyActor].withDispatcher("my-dispatcher"), name = "myactor")
}

我正在关注这个例子。 http://doc.akka.io/docs/akka/2.0.2/scala/dispatchers.html

我已经尝试将其添加到akka-2.0.2 / config / application.config中的application.config

1 个答案:

答案 0 :(得分:8)

在您的项目中,只需将application.conf放入src/main/resources文件夹即可。这应该有用。