Class FutureRef$

java.lang.Object
org.apache.pekko.pattern.FutureRef$

public class FutureRef$ extends Object
  • Field Details

    • MODULE$

      public static final FutureRef$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • FutureRef$

      public FutureRef$()
  • Method Details

    • apply

      public FutureRef<Object> apply(ActorSystem system, Timeout timeout)
      Constructs a new FutureRef which will be completed with the first message sent to it.

      
       // enables transparent use of FutureRef as ActorRef and Future
       import FutureRef.Implicits._
      
       val futureRef = FutureRef(system, 5.seconds)
       futureRef ! "message"
       futureRef.onComplete(println)  // prints "message"
       
    • apply

      public FutureRef<Object> apply(Timeout timeout, ActorSystem system)
      Constructs a new PromiseRef which will be completed with the first message sent to it.

      
       // enables transparent use of FutureRef as ActorRef and Promise
       import FutureRef.Implicits._
      
       // requires an implicit ActorSystem in scope
       val futureRef = FutureRef(5.seconds)
       futureRef ! "message"
       futureRef.onComplete(println)  // prints "message"