This is a Scala-based application using Akka Actor systems and MQTT Pub-Sub messaging on a scalable fault-tolerant distributed platform to simulate individual IoT (Internet of Things) devices, each maintaining its own internal state and setting. It's an expanded version (hence v.2) of another Akka-IoT application. For an overview of the application, please visit Genuine Blog.
To run the application on a single JVM with the default 20 devices, simply git-clone the repo to a local disk, open up a command line terminal, run the following command and observe the console output:
$ redis-server [/path/to/conf]
$ {project-root}/bin/sbt "runMain akkaiot.Main"
To run the application on separate JVMs with a given number of devices, please proceed as follows:
git-clone the repo to a local disk, open up separate command line terminals and launch the different components on separate terminals:
$ redis-server [/path/to/conf]
$ {project-root}/bin/sbt "runMain akkaiot.Main 2551"
$ {project-root}/bin/sbt "runMain akkaiot.Main 2552"
$ {project-root}/bin/sbt "runMain akkaiot.Main 3001 [numOfDevices]"
$ {project-root}/bin/sbt "runMain akkaiot.Main 0"
$ {project-root}/bin/sbt "runMain akkaiot.Main 0"
The optional numOfDevices
parameter, if not provided, defaults to 20.
To scale up work processing service for the IoT devices, start up additional worker (and/or master) nodes.
To test fault tolerance in the master cluster, stop a master node and observe how the cluster fails over to the next oldest master node.