Package actors

Class ActorsModule

  • All Implemented Interfaces:
    io.vertx.core.Verticle

    public abstract class ActorsModule
    extends io.vertx.core.AbstractVerticle
    Actor that acts as a module deploying and exposing all the deployed actors. Any non standard message can be sent registering a codec overwriting the method registerMessageCodecs(Vertx).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Actors actors
      Factory to deploy or spawn actors
      • Fields inherited from class io.vertx.core.AbstractVerticle

        context, vertx
    • Constructor Summary

      Constructors 
      Constructor Description
      ActorsModule()  
    • Field Detail

      • actors

        protected Actors actors
        Factory to deploy or spawn actors
    • Constructor Detail

      • ActorsModule

        public ActorsModule()
    • Method Detail

      • defineActors

        protected abstract void defineActors​(List<Object> futures)
        The purpose of this method is to initialize the functions/consumers/suppliers defined in static fields of this class that will be exposed.
        Parameters:
        futures - the list of ActorRef wrapped in futures that were returned by the method deployActors()}.
      • deployActors

        protected abstract List<io.vertx.core.Future> deployActors()
        deploy all the actors of the module using the factory Actors
        Returns:
        a list of ActorRef wrapped in futures
      • start

        public void start​(io.vertx.core.Promise<Void> start)
        Specified by:
        start in interface io.vertx.core.Verticle
        Overrides:
        start in class io.vertx.core.AbstractVerticle
      • registerMessageCodecs

        protected void registerMessageCodecs​(io.vertx.core.Vertx vertx)
        Overwrite this method to register all the message codecs if you want to send any non standard message across the event bus.
        Parameters:
        vertx - the vertx instance where the module will be deployed
      • toActorRef

        protected <I,​O> ActorRef<I,​O> toActorRef​(Object object)
        Call this method from the defineActors(List) method to cast every object of the list into its real type ActorRef
        Type Parameters:
        I - the type of the input message
        O - the type of the output message
        Parameters:
        object - object result of deploying or spawing an actor with the factory Actors
        Returns:
        an ActorRef