I wonder is this a correct way to use context in typed actor:
def behaviour: Behavior[Protocol] = Behaviors.setup[Protocol] { ctx ⇒
// ....
def initState(state: State): Behavior[Protocol] = Behaviors.receiveMessage {
case Initialized =>
// context from Behavior.setup
ctx.log.debug(s"MESSAGE: Initialized")
// ...
}
initState(State.empty)
}
Do I need to use Behaviours.receive
to access context or it is ok to use context from upper Behaviours.setup
?