Package actors

Class Actor<I>

  • Type Parameters:
    I - type of the message sent to the actor
    All Implemented Interfaces:
    io.vertx.core.Verticle

    public class Actor<I>
    extends io.vertx.core.AbstractVerticle
    Represents an actor, which is a Verticle in Vertx jargon. It's the unit of computation.
    • Field Summary

      • Fields inherited from class io.vertx.core.AbstractVerticle

        context, vertx
    • Constructor Summary

      Constructors 
      Constructor Description
      Actor​(Consumer<io.vertx.core.eventbus.Message<I>> consumer, String address)
      Creates an actor instance that when deployed will process the messages sent to the given address
    • Constructor Detail

      • Actor

        public Actor​(Consumer<io.vertx.core.eventbus.Message<I>> consumer,
                     String address)
        Creates an actor instance that when deployed will process the messages sent to the given address
        Parameters:
        consumer - consumer that takes and processes the messages sent to this actor
        address - address where the actor is listening on
    • Method Detail

      • start

        public void start​(io.vertx.core.Promise<Void> promise)
        Register the given consumer listening on the given address. When it's done, this actor is ready to receive messages on that address.
        Specified by:
        start in interface io.vertx.core.Verticle
        Overrides:
        start in class io.vertx.core.AbstractVerticle
        Parameters:
        promise - promise to be completed when the consumer is registered
      • stop

        public void stop​(io.vertx.core.Promise<Void> promise)
        Unregister the consumer listening on the give address that was created during the start(Promise) method.
        Specified by:
        stop in interface io.vertx.core.Verticle
        Overrides:
        stop in class io.vertx.core.AbstractVerticle
        Parameters:
        promise - promise to be completed when the consumer is unregistered