Package actors
Class Actors
- java.lang.Object
-
- actors.Actors
-
public class Actors extends Object
Class that deploys and spawns verticles. If an address is not provided, one is generated. You only need a ActorRef to interact with a verticle. When a verticle is deployed it's waiting for messages to be processed. When a verticle is spawn, it processes a message or does some stuff and after that it's undeployed automatically. It register codecs to work with the immutable and persistent Jsons from the library json-values
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(String address, Consumer<io.vertx.core.eventbus.Message<I>> consumer)
It deploys a verticle that listen on the given address.<I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(String address, Consumer<io.vertx.core.eventbus.Message<I>> consumer, io.vertx.core.DeploymentOptions options)
<I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(String address, Function<I,O> fn)
<I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(String address, Function<I,O> fn, io.vertx.core.DeploymentOptions options)
<I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(Consumer<io.vertx.core.eventbus.Message<I>> consumer)
It deploys a verticle<I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(Consumer<io.vertx.core.eventbus.Message<I>> consumer, io.vertx.core.DeploymentOptions options)
<I,O>
io.vertx.core.Future<ActorRef<I,O>>deploy(Function<I,O> fn)
<I,O>
Supplier<Function<I,io.vertx.core.Future<O>>>spawn(Consumer<io.vertx.core.eventbus.Message<I>> consumer)
<I,O>
Supplier<Function<I,io.vertx.core.Future<O>>>spawn(Consumer<io.vertx.core.eventbus.Message<I>> consumer, io.vertx.core.DeploymentOptions options)
<I,O>
Supplier<Function<I,io.vertx.core.Future<O>>>spawn(Function<I,O> fn)
<I,O>
Supplier<Function<I,io.vertx.core.Future<O>>>spawn(Function<I,O> fn, io.vertx.core.DeploymentOptions options)
-
-
-
Constructor Detail
-
Actors
public Actors(io.vertx.core.Vertx vertx, io.vertx.core.DeploymentOptions deploymentOptions)
Creates a factory to deploy and spawn verticles- Parameters:
vertx
- the vertx instancedeploymentOptions
- the default deployment options that will be used for deploying and spawing verticles if one is not provided
-
Actors
public Actors(io.vertx.core.Vertx vertx)
Creates a factory to deploy and spawn verticles- Parameters:
vertx
- the vertx instance
-
-
Method Detail
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(String address, Consumer<io.vertx.core.eventbus.Message<I>> consumer)
It deploys a verticle that listen on the given address.- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
address
- the address of the verticleconsumer
- the consumer that will process the messages sent to the verticle- Returns:
- an ActorRef wrapped in a future
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(Consumer<io.vertx.core.eventbus.Message<I>> consumer)
It deploys a verticle- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
consumer
- the consumer that will process the messages sent to the verticle- Returns:
- an ActorRef wrapped in a future
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(Consumer<io.vertx.core.eventbus.Message<I>> consumer, io.vertx.core.DeploymentOptions options)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
consumer
- the consumer that will process the messages sent to the verticleoptions
- options for configuring the verticle deployment- Returns:
- an ActorRef wrapped in a future
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(String address, Consumer<io.vertx.core.eventbus.Message<I>> consumer, io.vertx.core.DeploymentOptions options)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
address
- the address of the verticleconsumer
- the consumer that will process the messages sent to the verticleoptions
- options for configuring the verticle deployment- Returns:
- an ActorRef wrapped in a future
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(String address, Function<I,O> fn, io.vertx.core.DeploymentOptions options)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
address
- the address of the verticlefn
- the function that takes a message of type I and produces an output of type Ooptions
- options for configuring the verticle deployment- Returns:
- an ActorRef wrapped in a future
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(String address, Function<I,O> fn)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
address
- the address of the verticlefn
- the function that takes the messages and produces an output- Returns:
- an ActorRef wrapped in a future
-
deploy
public <I,O> io.vertx.core.Future<ActorRef<I,O>> deploy(Function<I,O> fn)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
fn
- the function that takes a message of type I and produces an output of type O- Returns:
- an ActorRef wrapped in a future
-
spawn
public <I,O> Supplier<Function<I,io.vertx.core.Future<O>>> spawn(Consumer<io.vertx.core.eventbus.Message<I>> consumer)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
consumer
- the consumer that will process the messages sent to the verticle- Returns:
- an ActorRef wrapped in a future
-
spawn
public <I,O> Supplier<Function<I,io.vertx.core.Future<O>>> spawn(Consumer<io.vertx.core.eventbus.Message<I>> consumer, io.vertx.core.DeploymentOptions options)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
consumer
- the consumer that will process the messages sent to the verticleoptions
- options for configuring the verticle deployment- Returns:
- an ActorRef wrapped in a future
-
spawn
public <I,O> Supplier<Function<I,io.vertx.core.Future<O>>> spawn(Function<I,O> fn, io.vertx.core.DeploymentOptions options)
- Type Parameters:
I
- the type of the message sent to the verticleO
- the type of the reply- Parameters:
fn
- the function that takes a message of type I and produces an output of type Ooptions
- options for configuring the verticle deployment- Returns:
- an ActorRef wrapped in a future
-
spawn
public <I,O> Supplier<Function<I,io.vertx.core.Future<O>>> spawn(Function<I,O> fn)
- Type Parameters:
I
- the type of the input messageO
- the type of the output- Parameters:
fn
- the function that takes a message of type I and produces an output of type O- Returns:
- an ActorRef wrapped in a future
-
-