Updates after feedback
This commit is contained in:
parent
83b08b20d9
commit
5fd40e53ca
9 changed files with 33 additions and 71 deletions
|
|
@ -8,10 +8,6 @@ import akka.actor.Props
|
|||
|
||||
//#imports
|
||||
|
||||
//#imports2
|
||||
import akka.actor.mailbox.FileDurableMailboxType
|
||||
//#imports2
|
||||
|
||||
import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
||||
import org.scalatest.matchers.MustMatchers
|
||||
import akka.testkit.AkkaSpec
|
||||
|
|
@ -42,13 +38,4 @@ class DurableMailboxDocSpec extends AkkaSpec(DurableMailboxDocSpec.config) {
|
|||
//#dispatcher-config-use
|
||||
}
|
||||
|
||||
"programatically define dispatcher with durable mailbox" in {
|
||||
//#prog-define-dispatcher
|
||||
val dispatcher = system.dispatcherFactory.newDispatcher(
|
||||
"my-dispatcher", throughput = 1, mailboxType = FileDurableMailboxType).build
|
||||
val myActor = system.actorOf(Props[MyActor].withDispatcher(dispatcher))
|
||||
//#prog-define-dispatcher
|
||||
myActor ! "hello"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,11 @@ import akka.actor.Props;
|
|||
|
||||
//#imports
|
||||
|
||||
//#imports2
|
||||
import akka.actor.mailbox.DurableMailboxType;
|
||||
//#imports2
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import akka.testkit.AkkaSpec;
|
||||
import akka.docs.dispatcher.DispatcherDocSpec;
|
||||
import com.typesafe.config.ConfigFactory;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
|
|
@ -55,22 +50,9 @@ public class DurableMailboxDocTestBase {
|
|||
myActor.tell("test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void programaticallyDefinedDispatcher() {
|
||||
//#prog-define-dispatcher
|
||||
MessageDispatcher dispatcher = system.dispatcherFactory()
|
||||
.newDispatcher("my-dispatcher", 1, DurableMailboxType.fileDurableMailboxType()).build();
|
||||
ActorRef myActor = system.actorOf(new Props().withDispatcher(dispatcher).withCreator(new UntypedActorFactory() {
|
||||
public UntypedActor create() {
|
||||
return new MyUntypedActor();
|
||||
}
|
||||
}), "myactor");
|
||||
//#prog-define-dispatcher
|
||||
myActor.tell("test");
|
||||
}
|
||||
|
||||
public static class MyUntypedActor extends UntypedActor {
|
||||
public void onReceive(Object message) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue