I’d really like to be able to specify a function that is evaluated when transitioning from one behaviour to another in Akka Typed, particularly when expressing an FSM. Is this possible?
Could you describe more about why you need it, so I understand better.
Typically you create the new behavior by calling a method that returns the new behavior. Can’t you do the transition logic in those methods?
If you are looking for a general purpose solution it should be possible to implement such transition listener in a
BehaviorInterceptor. Looking at the returned behavior to see if it’s
Behaviors.same or not.
I was looking for something similar to the untyped FSM where transitional behaviour can be specified. I wasn’t aware of the interceptor functionality. Is there some doc or an example?