PJCB is a platform that supports a RabbitMQ-based exchange of events coming in through the REST API endpoint.
- Java 8
- clone this repository
- (under *NIX) you may need to
- create a normal and a test database on your MySQL server
.sqlscript to create the tables for the normal database is in
- test database should remain empty, as it is used automatically during testing
- update the configuration in
src/main/resources/application.confwith your access details
The application comes with two basic methods of running - the CLI/Integrated and the Server mode. While the latter serves only to start a REST API to receive input from, the former may be configured to do both the API and the CLI output. If not running as a server, the CLI may be started multiple times wherever desired, so long as it's able to connect to the RabbitMQ broker.
The server only supports a single mode, ran through
sbt server, in which it listens to the configured endpoint and relays the messages to the broker.
CLI can be started with a basic command of
sbt cli in which it will simply relay all messages received from the broker. It can also be switched into aggregate and integrated modes, together with a support for filtering, for a total signature of
sbt "cli [-a] [-s] [<filter list ...>]".
sbt "cli 1 2 3 4"will filter only the messages with IDs 1, 2, 3 and 4.
sbt "cli -a"will switch to aggregate mode, in which the incoming messages will be displayed in a sum-total style in a table
sbt "cli -s"is the integrated mode, which runs both the API and the CLI
- by combining the switches it is possible to run,
sbt "cli -as 1 2 3", which is an integrated mode that also displays an aggregation of messages with IDs 1, 2 or 3
Unit tests can be run with the standard
sbt test command. To test the performance specifically, a configuration is supplied in
apache-jmeter-benchmark.jmx for the Apache JMeter.
The application is written in Scala, using the Akka library to perform most of the heavy tasks though AkkaActors and the AkkaHttp framework for the REST API. This design allows the application to be responsive and leverage Scala's concurrency for performance and scalability.
By using an external PubSub message broker like RabbitMQ it can achieve very high speeds while also not tying itself down to a single instance or machine - a CLI can access the message system from anywhere it can establish a connection to the broker. The database used for persistant storage is MySQL to achieve the reliablity of a classical relational database for the accounts.
The application is fault tolerant and should only need to wait for the server(s) to be accessible (after a brief reconnect delay) before being operational again.