{"id":177,"date":"2020-07-25T15:13:04","date_gmt":"2020-07-25T14:13:04","guid":{"rendered":"https:\/\/blog.adonlon.org\/?p=177"},"modified":"2020-07-25T15:13:05","modified_gmt":"2020-07-25T14:13:05","slug":"anatomy-of-lagom-part-1-the-technical-stack","status":"publish","type":"post","link":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/","title":{"rendered":"Anatomy of Lagom Part 1: The Technical Stack"},"content":{"rendered":"\n<p>Lagom is a framework for building microservices. It&#8217;s based on Lightbend&#8217;s reactive technology stack. I&#8217;ve been playing around with the Scala version of it and I&#8217;m noting down some of my understanding here to supplement the Lagom (+ Play + Akka) documentation.<\/p>\n\n\n\n<p>Starting with the high level overview of the technical stack, Lagom has both Java and Scala based implementations. I only really have experience with the Scala version and there a Lagom project is a multi-module SBT project. Essentially each service uses the Play framework to implement HTTP APIs. Lagom provides a DSL over the Play API so defining the actual service is slightly different. However, it&#8217;s all built on top of Play. Within the world of HTTP APIs Lagom allows us to produce and consume both standard request-response APIs and Websocket streaming APIs. Lagom further allows us to publish messages to streaming topics via Kafka. Finally, serialisation between services, over either HTTP or Kafka, uses Play-JSON by default. It&#8217;s possible to configure other serialisation technologies.<\/p>\n\n\n\n<p>A key point here is that an instance of a Lagom service is just a Play server. The Lagom DSL is primarily aiming at configuring the server cleanly and easily.<\/p>\n\n\n\n<p>Within the Play services Lagom provides easy access to the Akka framework for defining actors. Newer versions of Lagom lean towards Akka-Typed. With the Akka framework comes not just the Actor implementation but also patterns around persistence, clustering and streaming. Akka actors persist to Cassandra, so they can then be recreated on any instance of the service in the cluster. Having said that not every actor needs to be persistent. Nor does every actor need to be sharded across the cluster.<\/p>\n\n\n\n<p>SBT will package Lagom services as docker containers. They can then be deployed to a number of container environments. Kubernetes is probably the simplest. There are a number of possible implementations of Lagom&#8217;s ServiceLocator interface. By default the framework will use an implementation based on Akka HTTP.<\/p>\n\n\n\n<p>In summary, there&#8217;s quite a lot of technology in a Lagom Microservice. As such, it&#8217;s worth having a working knowledge of each of these before you start building a Lagom microservice.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Scala<\/li><li>SBT<\/li><li>Play Framework<\/li><li>Akka<\/li><li>Akka Persistence<\/li><li>Akka Streaming<\/li><li>Akka Cluster<\/li><li>Akka HTTP Service Discovery<\/li><li>Cassandra<\/li><li>Kafka<\/li><li>Kubernetes<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lagom is a framework for building microservices. It&#8217;s based on Lightbend&#8217;s reactive technology stack. I&#8217;ve been playing around with the Scala version of it and I&#8217;m noting down some of my understanding here to supplement the Lagom (+ Play + Akka) documentation. Starting with the high level overview of the technical stack, Lagom has both [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[6,12],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-akka","tag-lagom"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Anatomy of Lagom Part 1: The Technical Stack - Pragmatic Software Engineering<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Anatomy of Lagom Part 1: The Technical Stack - Pragmatic Software Engineering\" \/>\n<meta property=\"og:description\" content=\"Lagom is a framework for building microservices. It&#8217;s based on Lightbend&#8217;s reactive technology stack. I&#8217;ve been playing around with the Scala version of it and I&#8217;m noting down some of my understanding here to supplement the Lagom (+ Play + Akka) documentation. Starting with the high level overview of the technical stack, Lagom has both [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\" \/>\n<meta property=\"og:site_name\" content=\"Pragmatic Software Engineering\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-25T14:13:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-25T14:13:05+00:00\" \/>\n<meta name=\"author\" content=\"alastair\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"alastair\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\"},\"author\":{\"name\":\"alastair\",\"@id\":\"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1\"},\"headline\":\"Anatomy of Lagom Part 1: The Technical Stack\",\"datePublished\":\"2020-07-25T14:13:04+00:00\",\"dateModified\":\"2020-07-25T14:13:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\"},\"wordCount\":388,\"publisher\":{\"@id\":\"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1\"},\"keywords\":[\"akka\",\"lagom\"],\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\",\"url\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\",\"name\":\"Anatomy of Lagom Part 1: The Technical Stack - Pragmatic Software Engineering\",\"isPartOf\":{\"@id\":\"https:\/\/blog.adonlon.org\/#website\"},\"datePublished\":\"2020-07-25T14:13:04+00:00\",\"dateModified\":\"2020-07-25T14:13:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.adonlon.org\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Anatomy of Lagom Part 1: The Technical Stack\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.adonlon.org\/#website\",\"url\":\"https:\/\/blog.adonlon.org\/\",\"name\":\"Pragmatic Software Engineering\",\"description\":\"Random thoughts and insights on software engineering\",\"publisher\":{\"@id\":\"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.adonlon.org\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1\",\"name\":\"alastair\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/blog.adonlon.org\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf9abf1220f449fccd0f6795d12b05cb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf9abf1220f449fccd0f6795d12b05cb?s=96&d=mm&r=g\",\"caption\":\"alastair\"},\"logo\":{\"@id\":\"https:\/\/blog.adonlon.org\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Anatomy of Lagom Part 1: The Technical Stack - Pragmatic Software Engineering","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/","og_locale":"en_GB","og_type":"article","og_title":"Anatomy of Lagom Part 1: The Technical Stack - Pragmatic Software Engineering","og_description":"Lagom is a framework for building microservices. It&#8217;s based on Lightbend&#8217;s reactive technology stack. I&#8217;ve been playing around with the Scala version of it and I&#8217;m noting down some of my understanding here to supplement the Lagom (+ Play + Akka) documentation. Starting with the high level overview of the technical stack, Lagom has both [&hellip;]","og_url":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/","og_site_name":"Pragmatic Software Engineering","article_published_time":"2020-07-25T14:13:04+00:00","article_modified_time":"2020-07-25T14:13:05+00:00","author":"alastair","twitter_card":"summary_large_image","twitter_misc":{"Written by":"alastair","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/#article","isPartOf":{"@id":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/"},"author":{"name":"alastair","@id":"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1"},"headline":"Anatomy of Lagom Part 1: The Technical Stack","datePublished":"2020-07-25T14:13:04+00:00","dateModified":"2020-07-25T14:13:05+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/"},"wordCount":388,"publisher":{"@id":"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1"},"keywords":["akka","lagom"],"articleSection":["Uncategorized"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/","url":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/","name":"Anatomy of Lagom Part 1: The Technical Stack - Pragmatic Software Engineering","isPartOf":{"@id":"https:\/\/blog.adonlon.org\/#website"},"datePublished":"2020-07-25T14:13:04+00:00","dateModified":"2020-07-25T14:13:05+00:00","breadcrumb":{"@id":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.adonlon.org\/index.php\/2020\/07\/25\/anatomy-of-lagom-part-1-the-technical-stack\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.adonlon.org\/"},{"@type":"ListItem","position":2,"name":"Anatomy of Lagom Part 1: The Technical Stack"}]},{"@type":"WebSite","@id":"https:\/\/blog.adonlon.org\/#website","url":"https:\/\/blog.adonlon.org\/","name":"Pragmatic Software Engineering","description":"Random thoughts and insights on software engineering","publisher":{"@id":"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.adonlon.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.adonlon.org\/#\/schema\/person\/4c5a1b2463425db9814bf8540f8954c1","name":"alastair","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/blog.adonlon.org\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf9abf1220f449fccd0f6795d12b05cb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf9abf1220f449fccd0f6795d12b05cb?s=96&d=mm&r=g","caption":"alastair"},"logo":{"@id":"https:\/\/blog.adonlon.org\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":0,"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.adonlon.org\/index.php\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}