From 0ea1dea99d05ff69891ab38bef11775c5fcfe98e Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Tue, 17 Dec 2019 14:24:32 +0100 Subject: [PATCH] [doc] unhandled vs empty vs ignore #27443 --- akka-docs/src/main/paradox/typed/fsm.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/akka-docs/src/main/paradox/typed/fsm.md b/akka-docs/src/main/paradox/typed/fsm.md index 02136e7b20..a9d28486c1 100644 --- a/akka-docs/src/main/paradox/typed/fsm.md +++ b/akka-docs/src/main/paradox/typed/fsm.md @@ -43,6 +43,18 @@ Scala Java : @@snip [FSMSocTest.java](/akka-actor-typed-tests/src/test/java/jdocs/akka/typed/FSMDocTest.java) { #simple-state} +@scala[ +The method `idle` above makes use of `Behaviors.unhandled` which advises the system to reuse the previous behavior, +including the hint that the message has not been handled. +There are two related behaviors: + +- return `Behaviors.empty` as next behavior in case you reached a state where you don't expect messages any more. + For instance if an actor only waits until all spawned child actors stopped. + Unhandled messages are still logged with this behavior. +- return `Behaviors.ignore` as next behavior in case you don't care about unhandled messages. + All messages sent to an actor with such a behavior are simply dropped and ignored (without logging) +] + To set state timeouts use `Behaviors.withTimers` along with a `startSingleTimer`. ## Example project