x
, y
, and z
with the major version, minor version, and patch version, respectively, for the artifact.xoom-actors.properties
that is already provided when you use Designer for generating your project. In case you prefer to create it manually, the Actors documentation will be very useful.Boot
API. There are three ways to do so. One way is through a void main(String[] args)
boot method.main()
would normally be invoked by the Java runtime. This demonstrates that if any command-line arguments are received, the first argument will be used to name the World
. If there are no command-line arguments, the World
will be named "vlingo-xoom"
.Boot.start(String name)
method.@Xoom
annotation:@Xoom
does not require any method implementation because the annotation itself is sufficient to boot the application. Furthermore, you can add the blocking
attribute to enable/disable synchronous actor messaging.blocking
is false
and, when used, @Xoom
annotation attributes always override what has been set in xoom-turbo.properties
. In other words, if the Initializer class is annotated with blocking=false
and BlockingMailbox
is enabled in the properties file, the @Xoom
attribute prevails, causing actors to communicate asynchronously.World
and any living part of it to explore the marvels of the platform.DeliveryProtocol
.reactTo()
message handlers. This actor does just a few things when it receives each message type. It formats a string to indicate what happened. It logs that message through the standard io.vlingo.xoom.actors.Logger
protocol that is available to all io.vlingo.xoom.actors.Actor
extenders. Each of the message handlers appends the formatted text description to a List
held by its state. This state is held so that a client of this actor can query for all its reactions.reactions()
. It answers the full List
resulting from the various reactTo()
messages received. Note that it doesn't just answer the raw, mutable List
. Instead it provides an immutable List
, so that its state cannot be tampered with by anyone on the outside. In addition, it answers the immutable List
as a Completes<T>
outcome.Completes<T>
here. In brief it is a means for asynchronous query operations being executed on separate threads to provide eventual answers to a requester. Of course, this actor is running within a World
running on VLINGO XOOM, and thus is not asynchronous. Still, we don't change the entire platform API to accommodate use in a blocking environment. We want you to learn in comfort, but learn something new and experience the API in a safe haven.World
through which it may send messages to the actor that supplies the DeliveryProtocol
.DeliveryProtocolActor
uses the configured default mailbox. This is so because the code using actorFor()
doesn't pass a specific mailbox name, meaning that the default mailbox is used. You can configure VLINGO XOOM to default to the BlockingMailbox
, by placing the following configuration in the xoom-actors.properties;
note the line containing ...defaultMailbox = true
DeliveryProtocol
then sends messages, each of the three types of reactTo()
that can be sent. Finally, it asks the actor to answer its collected reactions by way ofCompletes<List<String>>
. Note that the test client receives the outcome by using the andThenConsume(function)
. Inside this lambda an assertion is made that the List
is expected to have three elements, one for each of the command messages sent.RequestProtocol
being the first.RequestProtocol
may receive a request()
and respond to the second protocol by sending it a response()
. After some expected outcome of request-response, the second protocol can be queried for a total.RequestProtocolActor
responds to the received request by adding 1
to the value
it receives. The response actor receives a response and tracks the total
until a desired outcome.start()
life cycle message is received just following construction. This is where the response actor starts the request-response process by sending a total
of 0
to the request handler actor. The request-response continues until the response actor reaches a value
of 10
or greater.