Merge pull request #17925 from ktoso/wip-move-BackoffSupervisor-ktoso
!per +act #17842 move BackoffSupervisor to akka.pattern
This commit is contained in:
commit
bbd5b2c739
13 changed files with 123 additions and 15 deletions
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package docs.pattern
|
||||
|
||||
import akka.actor.{ActorSystem, Props}
|
||||
import akka.pattern.BackoffSupervisor
|
||||
import akka.testkit.TestActors.EchoActor
|
||||
|
||||
class BackoffSupervisorDocSpec {
|
||||
|
||||
class BackoffSupervisorDocSpecExample {
|
||||
val system: ActorSystem = ???
|
||||
import scala.concurrent.duration._
|
||||
|
||||
//#backoff
|
||||
val childProps = Props(classOf[EchoActor])
|
||||
|
||||
val supervisor = BackoffSupervisor.props(
|
||||
childProps,
|
||||
childName = "myEcho",
|
||||
minBackoff = 3.seconds,
|
||||
maxBackoff = 30.seconds,
|
||||
randomFactor = 0.2) // adds 20% "noise" to vary the intervals slightly
|
||||
|
||||
system.actorOf(supervisor, name = "echoSupervisor")
|
||||
//#backoff
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
package docs.persistence
|
||||
|
||||
import akka.actor.{ Actor, ActorRef, ActorSystem, Props }
|
||||
import akka.pattern.BackoffSupervisor
|
||||
import akka.persistence._
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue