This section describes how to sanity test that your environment has been setup correctly to build and run X applications. We will do this using the Talon Starter Application which is included as one of the applications in the samples repository.

It is a good idea to download and run the starter application not only from the point of view of sanity testing your environment but also because we use this application to demonstrate how to use various features of an X application as well as to illustrate how non-functional aspects of the platform, such as configuration, horizontal scaling, message passing and high availability work in the platform.

Download the Application

Execute the following to download the repository:

git clone https://github.com/neeveresearch/nvx-samples

This will download the samples repository to a folder named nvx-samples relative to the directory from where the above command was executed.

If you do not have git installed on your local machine, go the samples repository, click on the "Clone or Download" button and follow instructions to download the application to your machine.

The Talon starter application is in the subdirectory nvx-app-talon-starter.

Build the Application

Execute the following to build all the sample applications including the starter application

cd nvx-samples
mvn -DskipTests clean install

The above will build the application and install it to your local maven repository.

The sample application is implemented such that it can be built as is using Java 8. If you are building using Java 11 or beyond, you will need to add the extra dependencies specified in the Building Using Java 11 and Beyond section

The Starter Application

 The starter application is comprised of three microservices

 

 

The Processor is a clustered, stateful, highly available and fault tolerant service. Stateful means it stores data that is durably persisted over time. Fault tolerant means that it will continue to operate without data or message loss in the event a resource failure. Highly available means that the MTTR to recovery on failure is minimal and clustered means that it implements high availability by means of hot standby clustering.

In the starter application, the Sender service sends messages which are received by the Processor. The Processor stores a count of messages is has received from the sender. Upon receipt of a message, the Processr increments its messages count in irs store and sends another message. This message is received by the downstream Receiver microservice.

Run the Application

This section describes how to run the starter application. A successful launch and run of the application effectively means that your environment is set up correctly to build and run X applications.

Download and Install the Messaging Bus

X applications need a messaging bus for message passing between the application's microservices. We use the ActiveMQ messaging bus with the starter application to sanity test your environment.

Out of the box, the X Platform supports several messaging bus providers such as Solace, JMS, ActiveMQ and Kafka. There is also a high performance messaging system being developed natively in the X Platform.

Install and Run ActiveMQ

Download a binary distribution of ActiveMQ and unpack it into some directory. Then, type the following commands from the directory in which you have just unpacked the ActiveMQ distribution

cd bin
activemq

The ActiveMQ broker should launch and be ready ready for messaging.

Launch the Starter Microservices

If you are using Java 11 or beyond to run the application, then please refer to the Supported OS and Runtimes for instructions on Java modules to enable.

Start the Receiver

Execute the following from a new command shell

$JAVA_HOME/java -Djava.net.preferIPv4Stack=true -cp "target/*:target/dependency/*" com.neeve.server.Main -n receiver -p desktop,activemq
%JAVA_HOME\java -Djava.net.preferIPv4Stack=true -cp "target\*;target\dependency\*" com.neeve.server.Main -n receiver -p desktop,activemq 

You should see the trace similar to the following. This indicates that the receiver has successfully started.

...
<1,9705,My-MacBook-Pro.local> 20161101-07:34:25:476 (inf)...[AepEngine<receiver>] Engine started [Standalone, Non-Persistent, ICR Off].
<1,9705,My-MacBook-Pro.local> 20161101-07:34:25:476 (inf)...Server (NAME=receiver) startup complete.
.
.
.
<31,9705,My-MacBook-Pro.local> 20161101-07:34:25:500 (inf)...[AepEngine<receiver>] Messaging started. 

Start the Processor Cluster

Execute the following from a new command shell

%JAVA_HOME\java -Djava.net.preferIPv4Stack=true -cp "target\*;target\dependency\*" com.neeve.server.Main -n processor-1 -p desktop,activemq 
%JAVA_HOME\java -Djava.net.preferIPv4Stack=true -cp "target\*;target\dependency\*" com.neeve.server.Main -n processor-1 -p desktop,activemq 

You should see the trace similar to the following. This indicates that the processor has successfully started.

<32,8456,My-MacBook-Pro.local> 20161030-16:22:59:083 (inf)...[RogLog->'processor'] Live transaction log file is 'processor.log'...
<32,8456,My-MacBook-Pro.local> 20161030-16:22:59:397 (inf)...Log preallocation (length=1073741824, mode=setLength) took 309 milliseconds.
<32,8456,My-MacBook-Pro.local> 20161030-16:22:59:405 (inf)...[RogLog->'processor'] Scavenging old log files....
<32,8456,My-MacBook-Pro.local> 20161030-16:22:59:405 (inf)...[RogLog->'processor'] ....scavenged 0 files (0 failed).
<1,8456,My-MacBook-Pro.local> 20161030-16:22:59:408 (inf)...[RogLog->'processor'] Materialized 0 entries (0 transactions) from the transaction log (in < 1 second).
<1,8456,My-MacBook-Pro.local> 20161030-16:22:59:409 (inf)...Initialization complete. Synchronized to transaction id #0 in the store.
<31,8456,My-MacBook-Pro.local> 20161030-16:22:59:710 (inf)...[AepEngine<processor>] Retransmitted 0 messages.
<1,8456,My-MacBook-Pro.local> 20161030-16:22:59:710 (inf)...[AepEngine<processor>] Engine started [Clustered, Primary, Persistent, ICR Off].
.
.
.
<31,8456,My-MacBook-Pro.local> 20161030-16:22:59:712 (inf)...[AepEngine<processor>] Messaging started.

The processor is a clustered service. Execute the following from a new command shell to start the second instance in the Processor cluster

$JAVA_HOME/java -Djava.net.preferIPv4Stack=true -cp "target/*:target/dependency/*" com.neeve.server.Main -n processor-2 -p desktop,activemq 
$JAVA_HOME/java -Djava.net.preferIPv4Stack=true -cp "target/*:target/dependency/*" com.neeve.server.Main -n processor-2 -p desktop,activemq 

You should see trace similar to the following on the newly launched cluster instance:

<1,12030,My-MacBook-Pro.local> 20161102-23:59:46:258 (inf)...[AepEngine<processor>] Engine started [Clustered, Backup, Persistent, ICR Off].

and the trace similar to the following on the first instance

<31,11825,My-MacBook-Pro.local> 20161102-23:58:03:891 (inf)...[B->processor-11cdf912-f6a6-46c3-b74f-7578cf453652] Initializing member '4a2fd486-68da-47d5-95e6-b70ffab08086'...
<31,11825,My-MacBook-Pro.local> 20161102-23:59:46:231 (inf)...[B->processor-11cdf912-f6a6-46c3-b74f-7578cf453652] Member '4a2fd486-68da-47d5-95e6-b70ffab08086' initialization complete (transaction id=-1)...
<31,11825,My-MacBook-Pro.local> 20161102-23:59:46:231 (inf)...[RogLog->'processor'] Initialization complete. Synchronized to transaction id #20808 on the primary.

Start the Sender

Execute the following from a new command shell

%JAVA_HOME\java -Djava.net.preferIPv4Stack=true -cp "target\*;target\dependency\*" com.neeve.server.Main -n sender -p desktop,activemq 
%JAVA_HOME\java -Djava.net.preferIPv4Stack=true -cp "target\*;target\dependency\*" com.neeve.server.Main -n sender -p 
desktop,activemq 

You should see the trace similar to the following. This indicates that the sender has successfully started.

<1,10110,My-MacBook-Pro.local> 20161101-09:30:18:827 (inf)...[AepEngine<sender>] Engine started [Standalone, Non-Persistent, ICR Off].
.
.
.
<31,10110,My-MacBook-Pro.local> 20161101-09:30:18:829 (inf)...[AepEngine<sender>] Messaging started.
Press Enter to send 10000 messages...

Run the Sender

The sender is programmed to wait for user input before sending any messages. Hit once you see the "Press Enter to send 10000 messages" message above. This will trigger the sending of 10k messages at 1k msgs/sec. You should see the following trace on the sender, processor, and receiver.

Press Enter to send 10000 messages...
Sent 1000 messages
Sent 2000 messages
.
.
.
Sent 10000 messages
Press Enter to send 10000 messages...
Processed 1000 messages
Processed 2000 messages
.
.
.
Processed 10000 messages
Received 1000 messages
Received 2000 messages
.
.
.
Received 10000 messages