Class AskPattern

  • public class AskPattern
    extends java.lang.Object
    The ask-pattern implements the initiator side of a request–reply protocol.

    Note that if you are inside of an actor you should prefer ActorContext.ask as that provides better safety.

    The party that asks may be within or without an Actor, since the implementation will fabricate a (hidden) ActorRef that is bound to a CompletableFuture. This ActorRef will need to be injected in the message that is sent to the target Actor in order to function as a reply-to address, therefore the argument to the ask method is not the message itself but a function that given the reply-to address will create the message.

    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​U>
      ask​(RecipientRef<T> actor, Function<ActorRef<U>,​T> message, java.time.Duration timeout, Scheduler scheduler)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AskPattern

        public AskPattern()
    • Method Detail

      • ask

        public static <T,​U> java.util.concurrent.CompletionStage<U> ask​(RecipientRef<T> actor,
                                                                              Function<ActorRef<U>,​T> message,
                                                                              java.time.Duration timeout,
                                                                              Scheduler scheduler)