!per +act #17842 move BackoffSupervisor to akka.pattern
This commit is contained in:
parent
403369a29e
commit
86c00d4716
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
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue