Async next behavior?

Is there possible to return the next behavior depending on async operation ? Here is an example

        .onMessage(Move.class, (context, message) -> {
            CompletionStage<Behaviors<Move>> nextBehavior = doSomethingAsync().thenApply(result -> {
                if (result != null)
                    return moveToLeftBehavior();
                    return moveToRightBehavior();

            return nextBehavior; // I can return this

I think the best solution would be to context.pipteToSelf() and to handle acync result on it.

I assume that you don’t want to process any other messages until the CompletionStage has been completed. Then you would combine context.pipteToSelf with stashing. There is an example in the Stash documentation.

Thanks that helps