Async next behavior?

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

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

            return nextBehavior; // I can return this
        })
        .build();

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