2011-12-19 11:07:59 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
2011-12-12 08:37:18 +01:00
|
|
|
package akka.docs.actor.mailbox
|
|
|
|
|
|
|
|
|
|
//#imports
|
|
|
|
|
import akka.actor.Actor
|
|
|
|
|
import akka.actor.Props
|
|
|
|
|
import akka.actor.mailbox.FileDurableMailboxType
|
|
|
|
|
|
|
|
|
|
//#imports
|
|
|
|
|
|
|
|
|
|
import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
|
|
|
|
import org.scalatest.matchers.MustMatchers
|
|
|
|
|
import akka.testkit.AkkaSpec
|
|
|
|
|
|
|
|
|
|
class MyActor extends Actor {
|
|
|
|
|
def receive = {
|
|
|
|
|
case x ⇒
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class DurableMailboxDocSpec extends AkkaSpec {
|
|
|
|
|
|
|
|
|
|
"define dispatcher with durable mailbox" in {
|
|
|
|
|
//#define-dispatcher
|
|
|
|
|
val dispatcher = system.dispatcherFactory.newDispatcher(
|
|
|
|
|
"my-dispatcher", throughput = 1, mailboxType = FileDurableMailboxType).build
|
|
|
|
|
val myActor = system.actorOf(Props[MyActor].withDispatcher(dispatcher), name = "myactor")
|
|
|
|
|
//#define-dispatcher
|
|
|
|
|
myActor ! "hello"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|