Skip to content

Reactive application with frontend and backend cooperating in akka cluster

Notifications You must be signed in to change notification settings

wilaszekg/akka-play-reactive-sse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactive application with frontend and backend cooperating in akka cluster

The application is splitted into fronted and backend projects. They share common messages API through api project. Additionally, the api project conatins akka.pubsub package with implementation of durable subscription.

It was presented at Scala World Unconference 2015

Durable subscription in Akka

Durable subscription allows frontend application to subscribe for events in Akka cluster. To implement durable subscription in Akka I have used Akka persistence and distributed publish-subscribe. The idea is to use persistent actors as publishers and persistent views as subscribers.

There are three different types of durable subscription:

  1. Persistent mode - which is simplest and uses only Akka persistence (without distributed publish-subscribe). A persistent view (subscriber) only reads events periodically
  2. Triggered mode - subscriber (persistent view) is triggered with distributed pub-sub to fetch events from database. It reduces number of database reads.
  3. Direct mode - subscriber receives events directly with distributed pub-sub and needs to read from database only in case of missed messages - when starting or recovering.

Running application

To run the application you need a database and its driver for Akka Persistence in version 2.4. The app is configured to work with Cassandra and the driver had to be installed locally from snapshot version. It takes a few seconds, but for further info and official releases look at Cassandra plugin Github

To run cluster nodes, you can use sbt aliases for backend seed nodes: sbt seed1 sbt seed2 And for frontend nodes: sbt front9001 sbt front9002 which run two web servers on ports 9001 and 9002.

To play with all features, including frontend nodes and server-to-client channels recovery, you need a load balancer dispatching to ports 9001 and 9002. To change ports configuration, look at build.sbt file and commands aliases defined there.

About

Reactive application with frontend and backend cooperating in akka cluster

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published