Package actors
Class Actor<I>
- java.lang.Object
-
- io.vertx.core.AbstractVerticle
-
- actors.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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
start(io.vertx.core.Promise<Void> promise)
Register the given consumer listening on the given address.void
stop(io.vertx.core.Promise<Void> promise)
Unregister the consumer listening on the give address that was created during thestart(Promise)
method.
-
-
-
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 actoraddress
- 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 interfaceio.vertx.core.Verticle
- Overrides:
start
in classio.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 thestart(Promise)
method.- Specified by:
stop
in interfaceio.vertx.core.Verticle
- Overrides:
stop
in classio.vertx.core.AbstractVerticle
- Parameters:
promise
- promise to be completed when the consumer is unregistered
-
-