#19246 Auto and manual reset and BackoffOptions.
Also moved `TransparantExponentialBackoffSupervisor` to `akka.pattern` (renamed to `BackoffOnRestartSupervisor`)
This commit is contained in:
parent
2bade93c31
commit
2404a9da01
12 changed files with 808 additions and 441 deletions
|
|
@ -5,7 +5,7 @@
|
|||
package docs.persistence
|
||||
|
||||
import akka.actor._
|
||||
import akka.pattern.BackoffSupervisor
|
||||
import akka.pattern.{ Backoff, BackoffSupervisor }
|
||||
import akka.persistence._
|
||||
import akka.stream.ActorMaterializer
|
||||
import akka.stream.scaladsl.{ Source, Sink, Flow }
|
||||
|
|
@ -85,17 +85,18 @@ object PersistenceDocSpec {
|
|||
}
|
||||
}
|
||||
|
||||
object Backoff {
|
||||
object BackoffOnStop {
|
||||
abstract class MyActor extends Actor {
|
||||
import PersistAsync.MyPersistentActor
|
||||
//#backoff
|
||||
val childProps = Props[MyPersistentActor]
|
||||
val props = BackoffSupervisor.props(
|
||||
childProps,
|
||||
childName = "myActor",
|
||||
minBackoff = 3.seconds,
|
||||
maxBackoff = 30.seconds,
|
||||
randomFactor = 0.2)
|
||||
Backoff.onStop(
|
||||
childProps,
|
||||
childName = "myActor",
|
||||
minBackoff = 3.seconds,
|
||||
maxBackoff = 30.seconds,
|
||||
randomFactor = 0.2))
|
||||
context.actorOf(props, name = "mySupervisor")
|
||||
//#backoff
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue