zwith the major version, minor version, and patch version, respectively, for the artifact.
BootAPI. 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
Worldwill be named
@Xoomdoes not require any method implementation because the annotation itself is sufficient to boot the application. Furthermore, you can add the
blockingattribute to enable/disable synchronous actor messaging.
falseand, when used,
@Xoomannotation attributes always override what has been set in
xoom-turbo.properties. In other words, if the Initializer class is annotated with
BlockingMailboxis enabled in the properties file, the
@Xoomattribute prevails, causing actors to communicate asynchronously.
Worldand any living part of it to explore the marvels of the platform.
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.Loggerprotocol that is available to all
io.vlingo.xoom.actors.Actorextenders. Each of the message handlers appends the formatted text description to a
Listheld 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
Listresulting 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
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
Worldrunning 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.
Worldthrough which it may send messages to the actor that supplies the
DeliveryProtocolActoruses 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
DeliveryProtocolthen 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 of
Completes<List<String>>. Note that the test client receives the outcome by using the
andThenConsume(function). Inside this lambda an assertion is made that the
Listis expected to have three elements, one for each of the command messages sent.
RequestProtocolbeing the first.
RequestProtocolmay 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.
RequestProtocolActorresponds to the received request by adding
valueit receives. The response actor receives a response and tracks the
totaluntil 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
0to the request handler actor. The request-response continues until the response actor reaches a