Package actors
Class ActorsModule
- java.lang.Object
-
- io.vertx.core.AbstractVerticle
-
- actors.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 methodregisterMessageCodecs(Vertx)
.
-
-
Constructor Summary
Constructors Constructor Description ActorsModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.protected abstract List<io.vertx.core.Future>
deployActors()
deploy all the actors of the module using the factoryActors
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.void
start(io.vertx.core.Promise<Void> start)
protected <I,O>
ActorRef<I,O>toActorRef(Object object)
Call this method from thedefineActors(List)
method to cast every object of the list into its real typeActorRef
-
-
-
Field Detail
-
actors
protected Actors actors
Factory to deploy or spawn actors
-
-
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 methoddeployActors()
}.
-
deployActors
protected abstract List<io.vertx.core.Future> deployActors()
deploy all the actors of the module using the factoryActors
- Returns:
- a list of ActorRef wrapped in futures
-
start
public void start(io.vertx.core.Promise<Void> start)
- Specified by:
start
in interfaceio.vertx.core.Verticle
- Overrides:
start
in classio.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 thedefineActors(List)
method to cast every object of the list into its real typeActorRef
- Type Parameters:
I
- the type of the input messageO
- the type of the output message- Parameters:
object
- object result of deploying or spawing an actor with the factoryActors
- Returns:
- an ActorRef
-
-