public class StepWise$
extends java.lang.Object
Example:
import scala.concurrent.duration._
StepWise[Command] { (ctx, startWith) =>
startWith {
val child = ctx.spawn(...)
child ! msg
child
}.expectMessage(100.millis) { (reply, child) =>
target ! GotReply(reply)
}
}
State can be passed from one step to the next by returning it as is
demonstrated with the child
ActorRef in the example.
This way of writing Actors can be very useful when writing Actor-based
test procedures for actor systems, hence also the possibility to expect
failures (see StepWise.Steps.expectFailure(scala.concurrent.duration.FiniteDuration, scala.Function2<akka.typed.Failed, U, scala.Tuple2<akka.typed.Failed.Decision, V>>)
).
Modifier and Type | Field and Description |
---|---|
static StepWise$ |
MODULE$
Static reference to the singleton instance of this Scala object.
|
Constructor and Description |
---|
StepWise$() |
Modifier and Type | Method and Description |
---|---|
<T> Behavior<T> |
apply(scala.Function2<ActorContext<T>,StepWise.StartWith<T>,StepWise.Steps<T,?>> f) |
public static final StepWise$ MODULE$
public <T> Behavior<T> apply(scala.Function2<ActorContext<T>,StepWise.StartWith<T>,StepWise.Steps<T,?>> f)