Package actors

Class ActorRef<I,​O>

  • Type Parameters:
    I - the type of the input message sent to this actor
    O - the type of the output message returned by this actor

    public class ActorRef<I,​O>
    extends Object
    It represents a reference to an actor, the unit of computation. It allows to send messages to the actor with the method tell(DeliveryOptions), or establish conversations with the method ask(DeliveryOptions).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      String address
      address where an actor is listening on
      Set<String> ids
      the identifiers assigned to the different instances of this actor after being deployed.
    • Field Detail

      • address

        public final String address
        address where an actor is listening on
      • ids

        public final Set<String> ids
        the identifiers assigned to the different instances of this actor after being deployed. To undeploy an actor, its identifier is needed.
    • Method Detail

      • ask

        public Function<I,​io.vertx.core.Future<O>> ask​(io.vertx.core.eventbus.DeliveryOptions options)
        Method to establish a conversation with this actor: a message is sent and then a message is received.
        Parameters:
        options - the delivery options
        Returns:
        a function that takes an object of type I and returns an object of type O wrapped in a future
      • ask

        public Function<I,​io.vertx.core.Future<O>> ask()
        Method to establish a conversation with this actor: a message is sent and then a message is received.
        Returns:
        a function that takes an object of type I and returns an object of type O wrapped in a future
      • tell

        public Consumer<I> tell​(io.vertx.core.eventbus.DeliveryOptions options)
        Method to send a message to this actor.
        Parameters:
        options - the delivery options
        Returns:
        a consumer that takes an object of type I
      • tell

        public Consumer<I> tell()
        Method to send a message to this actor.
        Returns:
        a consumer that takes an object of type I
      • undeploy

        public io.vertx.core.Future<Void> undeploy()
        Undeploy all the instances of this actor
        Returns:
        a future that will be completed when all the instances are undeployed