Search code examples
scalaplayframeworkplayframework-2.0akkalagom

Scala, Akka, Lagom, Play, Reactive and Microservices


I've been meaning to create MicroServices using Scala. Later we may need some web pages as well.

  1. What is Reactive programming in terms of Micro Services or REST HTTP?
  2. What is the relationship (if any) between Play, Lagom and Akka? Are they all used in making Micro Services?
  3. Is Play Reactive?
  4. Can MicroServices serve dynamic Web Pages? Or do I need a separate application for that?
  5. I have done some work with ReactJS. Does that fit anywhere in the picture?

Please help


Solution

    1. The question is a bit too broad to answer it here. But Jonas Bonér, the creator of Akka, explores the relationship between Microservices and Reactive Systems in his free ebook "Reactive Microservices Architecture", why don't you read that for a start.
    2. Akka is a library/tookit, it's more low-level and doesn't guide you towards using certain patterns as frameworks do. Play and Lagom are both frameworks that prescribe, to a certain extend, a structure, and provide more architectural guidance for your application. They are both built on top of Akka. There's quite a bit of overlap between Lagom and Play, e.g. you can use either to write RESTful HTTP services. Historically Play is a "full stack web framework", including server side rendering of HTML pages. Lagom is younger, was built explicitly for microservices, and has a lot of built-in support for typical architectural patterns and challenges in that area (e.g. service lookup, async messaging between services etc.)
    3. Yes, absolutely. For more info on that see for example "What Makes Play Frameworks Fast"?
    4. There are different schools of thought, some say services should provide their own UI, others will have a separate service for that. If you look at Lagom sample applications like Chirper or Auction, you'll see that server-side rendering of pages in there is done by Play applications, which use Lagom services as their backends.
    5. Yes, you can write you client application (which will run in the browser) with ReactJS and the server side with Lagom and/or Play, no problem.