Skip to content

fran0x/akka-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akka Services

Travis CI Status License

Summary

This is a study project for playing with Akka ecosystem:

Project Description

Structure

This project applies extensively the (Thin) Cake Pattern:

// launches a HTTP server
object Main extends App with Services

// initializes the actors system
trait Services extends Config with Routes

// loads configuration parameters (e.g. HTTP interface and port, eventually DB connection settings...)
trait Config

// provides the routes directives (very similar to the ones from Spray)
trait Routes extends ErrorHandler with SysRoute with UserRoute with UrlRoute with StocksRoute

trait ErrorHandler
trait SysRoute extends DefaultJsonProtocol with SprayJsonSupport // system functions
trait UserRoute extends DefaultJsonProtocol with SprayJsonSupport 
trait UrlRoute // simple URL shortener
trait StocksRoute // stocks info

// provide the domain objects, later marshalled / unmarshalled thanks to the JSON Support from Akka HTTP Spray Json  
case class SimpleMessage // used in SysRoute
case class User // used in UserRoute

How to Run

  1. Clone the project: git clone [email protected]:flopezlasanta/akka-services.git
  2. Compile the code, generate a Docker image and publish locally: $ sbt docker:publishLocal
  3. Run the container akka-services together with redis via Docker Compose: $ docker-compose up -d
  4. Test with the different end points (see next section)
  5. Stop the containers via Docker Compose: $ docker-compose stop

How to Test

Note: when using VM / Docker Machine (this is my case) then use its corresponding IP address; otherwise localhost.

  • Check system health: curl -X GET http://192.168.99.100:9000/sys/health | jq .
  • Ping system: curl -X GET http://192.168.99.100:9000/sys/ping | jq .
  • ...

Another options is to: Run in Postman

Also in root there will be simple website (made with Bootstrap 3) listing all endpoints:

About

A study project on Akka

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published