Going reactive (with the unfortunate tomcat7 and maven boilerplate)
This project shows as an example using akka cluster in tomcat7 with maven and scala to publish a message among all tomcat nodes.
Why with tomcat? Sometimes your system is already based on tomcat so you would not want akka as standalone (ie. the operations team already knows to monitor tomcat), in these cases you want akka on top of tomcat, if your system is also built on maven you also want your maven to be aware of akka (instead of using plain sbt).
Preparing your project for akka cluster and publish subscribe.
com.typesafe.akka akka-contrib_2.10 2.1.0which will enable you to use import DistributedPubSubMediator class.
You need to have a class named ScalatraBootsrap at the root of your project (src/scala) scalatra will search for this file by default. This file should initialize your actor system (as can be seen in example).
to run two nodes in the cluster see following configuration with intellij
and for the second node:
you must also run at least once mvn package and then in intellij +artifact deployment for the war
Call http://localhost:8080/publish
to sumbit from first node to both nodes (its a topic).
Call http://localhost:8081/publish
to publish from second node to both nodes..