SlideShare a Scribd company logo
HOW LAGOM HELPS
TO BUILD REAL WORLD
MICROSERVICE SYSTEMS
MARKUS EISELE
@MYFEAR
M@LIGHTBEND.COM
BLOG.EISELE.NET
! "
@Path("/orders/")
@Interceptors(CallAudit.class)
@Stateless public class OrderService {
@EJB BillingService billing;
@EJB DeliveryService delivery;
@EJB Warehouse warehouse;
@PUT
@Produces({"application/xml","application/json"})
@Consumes({"application/xml","application/json"})
public Order order(Order newOrder){
Order order = warehouse.checkout(newOrder);
billing.payForOrder(order);
delivery.deliver(order);
return order;
}
@GET
@Path("{orderid}/")
@Produces({"application/xml","application/json"})
public Order status(@PathParam("orderid") long orderId){
return delivery.status(orderId);
}
}
How lagom helps to build real world microservice systems
@Path("/orders/")
@Interceptors(CallAudit.class)
@Stateless public class OrderService {
private Client client;
private WebTarget tut;
// ...
@GET
@Path("{orderid}/")
@Produces({"application/xml","application/json"})
public Order status(@PathParam("orderid") long orderId){
// return delivery.status(orderId);
this.client = ClientBuilder.newClient();
this.tut = this.client.target("http://...");
Order order = this.client.target(location).request(MediaType.APPLICATION_XML).get(Order.class);
return order;
}
}
BUILDING ONE MICROSERVICE IS
GENERALLY EASY.
WHAT IS HARD IS BUILDING A SYSTEM OF
MICROSERVICES.
COMPLEX DEPLOYMENT
LARGE TEAMS
BREAKING UP MONOLITHS
ADDS COMPLEXITY
WHICH TECHNOLOGY TO CHOOSE?
DATA IN MOTION
Rather than acting on data at rest, modern software
increasingly operates on data in near real-time.
Traditional application
architectures
and platforms are obsolete.
— Gartner
WE USED THE RIGHT TOOLS
TO BUILD THE WRONG
THINGS.
AND WE STILL ARE MISSING TOOLS.
> Service Discovery
> Service Lookup
> API Management
> Security
> Protocols and Interfaces
> Data Access
> Developer Experience
PROTOCOLS AND INTERFACES
REST tends to be our go-to but…
> Don’t just do a 1:1 service/interface replacement
> Instead… Design for an asynchronous architecture
Pro-tip: Watch Ben Christensen’s “Don’t build a distributed
Monolith” talk from Microservices Practitioner Summit
2016
Architecture
and software design principles
matter even more today.
— Eisele
HOW TO DESIGN MICROSERVICES SYSTEMS
> Single Responsible Principle
> Service Oriented Architecture
> Encapsulation
> Separation of Concern
> Loose Coupling
> Hexagonal Architecture
SOFTWARE DESIGN PATTERNS
> Domain-driven Design
> Bounded Contexts
> Event Sourcing
> CQRS
> Eventual Consistency
> Context Maps
WE NEED TO BUILD
SYSTEMS FOR FLEXIBILITY
AND RESILIENCY, NOT
JUST EFFICIENCY AND
ROBUSTNESS.
CORE TENANTS
> Responsive
> Resilient
> Elastic
> Message driven
HOW LAGOM CAN HELP
> Developer experience first!
> No ad-hoc scripts to run your
services
> Takes you through to production
deployment
HIGHLY OPINIONATED
> Use context bounds as boundaries for services!
(Domain Driven Design)
> The event log is the book of record!
(Event Sourcing)
> Separate the read and write sides!
(CQRS)
> Microservices, too, need to be elastic and resilient!
LAGOM SERVICE API
> IO and communication
> Streaming between services as a first-class concept
> Higher level of resilience and scalability with no
blocking
> Service is a Bounded Context in DDD
> Service Clients & Endpoints
LAGOM PERSISTENCE API
> Event sourced (deltas) with Cassandra backend by
default
> No object/relational impedance mismatch
> Can always replay to determine current state
> Allows you to learn more from your data later
> Persistent entity is an Aggregate Root in DDD
> Can be overridden for CRUD if you want
How lagom helps to build real world microservice systems
How lagom helps to build real world microservice systems
DEVELOPMENT ENVIRONMENT
$ cd my-first-system
$ activator
... (booting up)
> runAll
[info] Starting embedded Cassandra server
..........
[info] Cassandra server running at 127.0.0.1:4000
[info] Service locator is running at http://localhost:8000
[info] Service gateway is running at http://localhost:9000
[info] Service helloworld-impl listening for HTTP on 0:0:0:0:0:0:0:0:24266
[info] Service hellostream-impl listening for HTTP on 0:0:0:0:0:0:0:0:26230
(Services started, use Ctrl+D to stop and go back to the console...)
WHAT IS TECHNICALLY IN LAGOM?
> sbt build tool
> Scala 2.11 and JDK8
> Play 2.5
> Akka 2.4
> Cassandra
> Jackson
> Google Guice
INTEGRATION WITH LAGOM
NEXT STEPS FOR LAGOM
> Scala API
> Swagger integration
> Maven support
> Support for more DBs
> Integration with other cluster orchestration tools
> … What is missing?
CARGO TRACKER EXAMPLE
https://github.com/lagom/activator-lagom-cargotracker
How lagom helps to build real world microservice systems
LEARN ABOUT LAGOM
Lagom on GitHub
Lagom Mailinglist
@Lagom
Chat Room
REACTIVE MICROSERVICES ARCHITECTURE
BIT.LY/REACTIVEMICROSERVICE
> explore a microservice architecture
> based on Reactive principles
> for building an isolated service
that’s
> scalable, resilient to failure,
> and combines with other services
> to form a cohesive whole
DEVELOPING REACTIVE MICROSERVICES
HTTP://BIT.LY/DEVELOPREACTIVEMICROSERVICE
> create base services, expose
endpoints, and then connect them
with a simple, web-based user
interface
> deal with persistence, state, and
clients
> Use integration technologies to
start a successful migration away
from legacy systems
NEXT STEPS
Project Site:
http://www.lightbend.com/lagom
GitHub Repo:
https://github.com/lagom
Documentation:
http://www.lagomframework.com/documentation/1.0.x/
Home.html
How lagom helps to build real world microservice systems

More Related Content

PDF
Lagom in Practice
PDF
Stay productive while slicing up the monolith
PDF
Service discovery in mesos miguel, Angel Guillen
PDF
CQRS and ES with Lagom
PDF
Cloud Foundry for Spring Developers
PDF
Cloud Foundry Summit 2015: Building a Robust Cloud Foundry (HA, Security and DR)
PDF
Service Discovery 101
PPTX
Kafka Connect - debezium
Lagom in Practice
Stay productive while slicing up the monolith
Service discovery in mesos miguel, Angel Guillen
CQRS and ES with Lagom
Cloud Foundry for Spring Developers
Cloud Foundry Summit 2015: Building a Robust Cloud Foundry (HA, Security and DR)
Service Discovery 101
Kafka Connect - debezium

What's hot (20)

PDF
12 Factor App: Best Practices for JVM Deployment
PPT
Flying to clouds - can it be easy? Cloud Native Applications
PDF
Microservices and modularity with java
PPT
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
PDF
Introduction to apache kafka
PDF
Virtualized Containers - How Good is it - Ananth - Siemens - CC18
PDF
Cloud Foundry Open Tour India 2012 , Keynote
PDF
CQRS and Event Sourcing for Java Developers
PPTX
DC/OS: The definitive platform for modern apps
PDF
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
PDF
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
PDF
SpringBoot and Spring Cloud Service for MSA
PDF
ARCHITECTING LARGE ENTERPRISE JAVA PROJECTS - vJUG
PPTX
JavaEE Microservices platforms
PDF
How Apache Kafka® Works
PDF
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
PDF
Tales from the four-comma club: Managing Kafka as a service at Salesforce | L...
PDF
MySQL Security on AWS Rds
PPTX
Integrating Microservices with Apache Camel
PPT
Sebastien goasguen cloud stack the next year
12 Factor App: Best Practices for JVM Deployment
Flying to clouds - can it be easy? Cloud Native Applications
Microservices and modularity with java
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
Introduction to apache kafka
Virtualized Containers - How Good is it - Ananth - Siemens - CC18
Cloud Foundry Open Tour India 2012 , Keynote
CQRS and Event Sourcing for Java Developers
DC/OS: The definitive platform for modern apps
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
SpringBoot and Spring Cloud Service for MSA
ARCHITECTING LARGE ENTERPRISE JAVA PROJECTS - vJUG
JavaEE Microservices platforms
How Apache Kafka® Works
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
Tales from the four-comma club: Managing Kafka as a service at Salesforce | L...
MySQL Security on AWS Rds
Integrating Microservices with Apache Camel
Sebastien goasguen cloud stack the next year
Ad

Viewers also liked (20)

PDF
Taking the friction out of microservice frameworks with Lagom
PDF
Architecting for failure - Why are distributed systems hard?
PDF
Lightweight Webservices with Sinatra and RestClient
PDF
Microservice Come in Systems
PDF
Wild Flies and a Camel Java EE Integration Stories
PDF
Wild Flies and a Camel - Chicago JUG - 03/15
PPT
What's New in WebLogic 12.1.3 and Beyond
PDF
Build Android OS on OSX
PDF
How would ESBs look like, if they were done today.
PDF
OpenShift for Java EE Developers
PDF
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
PDF
Community and Java EE @ DevConf.CZ
PPTX
2017 lvl1 api presentation march2017
PDF
Lightbend Lagom: Microservices Just Right
PDF
Architecting Large Enterprise Projects @DevConf.CZ
PDF
IoT Architecture
PDF
Modernizing Applications with Microservices
PDF
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
PDF
Developing applications with a microservice architecture (svcc)
PDF
Microservices pattern language (microxchg microxchg2016)
Taking the friction out of microservice frameworks with Lagom
Architecting for failure - Why are distributed systems hard?
Lightweight Webservices with Sinatra and RestClient
Microservice Come in Systems
Wild Flies and a Camel Java EE Integration Stories
Wild Flies and a Camel - Chicago JUG - 03/15
What's New in WebLogic 12.1.3 and Beyond
Build Android OS on OSX
How would ESBs look like, if they were done today.
OpenShift for Java EE Developers
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
Community and Java EE @ DevConf.CZ
2017 lvl1 api presentation march2017
Lightbend Lagom: Microservices Just Right
Architecting Large Enterprise Projects @DevConf.CZ
IoT Architecture
Modernizing Applications with Microservices
Modernizing Applications with Microservices and DC/OS (Lightbend/Mesosphere c...
Developing applications with a microservice architecture (svcc)
Microservices pattern language (microxchg microxchg2016)
Ad

Similar to How lagom helps to build real world microservice systems (20)

PDF
Stay productive_while_slicing_up_the_monolith
PDF
Trivadis TechEvent 2016 Introduction to Lagom - another microservice-based fr...
ODP
Introduction to Lagom Framework
PDF
Lagom - Mircoservices "Just Right"
PDF
Lagom : Reactive microservice framework
PDF
Stay productive while slicing up the monolith
PDF
Stay productive while slicing up the monolith
PDF
20160317 lagom sf scala
PDF
The Future of Services: Building Asynchronous, Resilient and Elastic Systems
PPTX
Closing keynote by Jamie Allen
PDF
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
PDF
The 6 Rules for Modernizing Your Legacy Java Monolith with Microservices
PDF
Intoduction to lagom framework
PPTX
20160520 The Future of Services
PDF
Lagom Workshop BarcelonaJUG 2017-06-08
PDF
Event Sourcing in less than 20 minutes - With Akka and Java 8
PPTX
Architectures, Frameworks and Infrastructure
PDF
SOA Latam 2015
PPTX
Building a massively scalabale cloud service from grounds up
ODP
Developing Microservices using Spring - Beginner's Guide
Stay productive_while_slicing_up_the_monolith
Trivadis TechEvent 2016 Introduction to Lagom - another microservice-based fr...
Introduction to Lagom Framework
Lagom - Mircoservices "Just Right"
Lagom : Reactive microservice framework
Stay productive while slicing up the monolith
Stay productive while slicing up the monolith
20160317 lagom sf scala
The Future of Services: Building Asynchronous, Resilient and Elastic Systems
Closing keynote by Jamie Allen
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
The 6 Rules for Modernizing Your Legacy Java Monolith with Microservices
Intoduction to lagom framework
20160520 The Future of Services
Lagom Workshop BarcelonaJUG 2017-06-08
Event Sourcing in less than 20 minutes - With Akka and Java 8
Architectures, Frameworks and Infrastructure
SOA Latam 2015
Building a massively scalabale cloud service from grounds up
Developing Microservices using Spring - Beginner's Guide

More from Markus Eisele (19)

PDF
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
PDF
Backstage Software Templates for Java Developers
PDF
SparksCon 2024 - Die Ringe der Macht
PDF
Sustainable Software Architecture - Open Tour DACH '22
PDF
Going from java message service (jms) to eda
PDF
Let's be real. Quarkus in the wild.
PDF
What happens when unicorns drink coffee
PDF
Stateful on Stateless - The Future of Applications in the Cloud
PDF
Java in the age of containers - JUG Frankfurt/M
PDF
Java in the Age of Containers and Serverless
PDF
Migrating from Java EE to cloud-native Reactive systems
PDF
Streaming to a new Jakarta EE / JOTB19
PDF
Cloud wars - A LavaOne discussion in seven slides
PDF
Streaming to a new Jakarta EE
PDF
Reactive Integrations - Caveats and bumps in the road explained
PDF
Nine Neins - where Java EE will never take you
PDF
10 Golden Social Media Rules for Developer Relations Manager
PDF
Hyperscale Computing, Enterprise Agility with Mesosphere
PDF
Java EE microservices architecture - evolving the monolith
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Backstage Software Templates for Java Developers
SparksCon 2024 - Die Ringe der Macht
Sustainable Software Architecture - Open Tour DACH '22
Going from java message service (jms) to eda
Let's be real. Quarkus in the wild.
What happens when unicorns drink coffee
Stateful on Stateless - The Future of Applications in the Cloud
Java in the age of containers - JUG Frankfurt/M
Java in the Age of Containers and Serverless
Migrating from Java EE to cloud-native Reactive systems
Streaming to a new Jakarta EE / JOTB19
Cloud wars - A LavaOne discussion in seven slides
Streaming to a new Jakarta EE
Reactive Integrations - Caveats and bumps in the road explained
Nine Neins - where Java EE will never take you
10 Golden Social Media Rules for Developer Relations Manager
Hyperscale Computing, Enterprise Agility with Mesosphere
Java EE microservices architecture - evolving the monolith

Recently uploaded (20)

PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Cloud computing and distributed systems.
PDF
Advanced IT Governance
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Cloud computing and distributed systems.
Advanced IT Governance
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
CIFDAQ's Market Insight: SEC Turns Pro Crypto
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Modernizing your data center with Dell and AMD
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf

How lagom helps to build real world microservice systems

  • 1. HOW LAGOM HELPS TO BUILD REAL WORLD MICROSERVICE SYSTEMS
  • 3. @Path("/orders/") @Interceptors(CallAudit.class) @Stateless public class OrderService { @EJB BillingService billing; @EJB DeliveryService delivery; @EJB Warehouse warehouse; @PUT @Produces({"application/xml","application/json"}) @Consumes({"application/xml","application/json"}) public Order order(Order newOrder){ Order order = warehouse.checkout(newOrder); billing.payForOrder(order); delivery.deliver(order); return order; } @GET @Path("{orderid}/") @Produces({"application/xml","application/json"}) public Order status(@PathParam("orderid") long orderId){ return delivery.status(orderId); } }
  • 5. @Path("/orders/") @Interceptors(CallAudit.class) @Stateless public class OrderService { private Client client; private WebTarget tut; // ... @GET @Path("{orderid}/") @Produces({"application/xml","application/json"}) public Order status(@PathParam("orderid") long orderId){ // return delivery.status(orderId); this.client = ClientBuilder.newClient(); this.tut = this.client.target("http://..."); Order order = this.client.target(location).request(MediaType.APPLICATION_XML).get(Order.class); return order; } }
  • 6. BUILDING ONE MICROSERVICE IS GENERALLY EASY. WHAT IS HARD IS BUILDING A SYSTEM OF MICROSERVICES.
  • 11. DATA IN MOTION Rather than acting on data at rest, modern software increasingly operates on data in near real-time.
  • 13. WE USED THE RIGHT TOOLS TO BUILD THE WRONG THINGS.
  • 14. AND WE STILL ARE MISSING TOOLS. > Service Discovery > Service Lookup > API Management > Security > Protocols and Interfaces > Data Access > Developer Experience
  • 15. PROTOCOLS AND INTERFACES REST tends to be our go-to but… > Don’t just do a 1:1 service/interface replacement > Instead… Design for an asynchronous architecture Pro-tip: Watch Ben Christensen’s “Don’t build a distributed Monolith” talk from Microservices Practitioner Summit 2016
  • 16. Architecture and software design principles matter even more today. — Eisele
  • 17. HOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture > Encapsulation > Separation of Concern > Loose Coupling > Hexagonal Architecture
  • 18. SOFTWARE DESIGN PATTERNS > Domain-driven Design > Bounded Contexts > Event Sourcing > CQRS > Eventual Consistency > Context Maps
  • 19. WE NEED TO BUILD SYSTEMS FOR FLEXIBILITY AND RESILIENCY, NOT JUST EFFICIENCY AND ROBUSTNESS.
  • 20. CORE TENANTS > Responsive > Resilient > Elastic > Message driven
  • 21. HOW LAGOM CAN HELP > Developer experience first! > No ad-hoc scripts to run your services > Takes you through to production deployment
  • 22. HIGHLY OPINIONATED > Use context bounds as boundaries for services! (Domain Driven Design) > The event log is the book of record! (Event Sourcing) > Separate the read and write sides! (CQRS) > Microservices, too, need to be elastic and resilient!
  • 23. LAGOM SERVICE API > IO and communication > Streaming between services as a first-class concept > Higher level of resilience and scalability with no blocking > Service is a Bounded Context in DDD > Service Clients & Endpoints
  • 24. LAGOM PERSISTENCE API > Event sourced (deltas) with Cassandra backend by default > No object/relational impedance mismatch > Can always replay to determine current state > Allows you to learn more from your data later > Persistent entity is an Aggregate Root in DDD > Can be overridden for CRUD if you want
  • 27. DEVELOPMENT ENVIRONMENT $ cd my-first-system $ activator ... (booting up) > runAll [info] Starting embedded Cassandra server .......... [info] Cassandra server running at 127.0.0.1:4000 [info] Service locator is running at http://localhost:8000 [info] Service gateway is running at http://localhost:9000 [info] Service helloworld-impl listening for HTTP on 0:0:0:0:0:0:0:0:24266 [info] Service hellostream-impl listening for HTTP on 0:0:0:0:0:0:0:0:26230 (Services started, use Ctrl+D to stop and go back to the console...)
  • 28. WHAT IS TECHNICALLY IN LAGOM? > sbt build tool > Scala 2.11 and JDK8 > Play 2.5 > Akka 2.4 > Cassandra > Jackson > Google Guice
  • 30. NEXT STEPS FOR LAGOM > Scala API > Swagger integration > Maven support > Support for more DBs > Integration with other cluster orchestration tools > … What is missing?
  • 33. LEARN ABOUT LAGOM Lagom on GitHub Lagom Mailinglist @Lagom Chat Room
  • 34. REACTIVE MICROSERVICES ARCHITECTURE BIT.LY/REACTIVEMICROSERVICE > explore a microservice architecture > based on Reactive principles > for building an isolated service that’s > scalable, resilient to failure, > and combines with other services > to form a cohesive whole
  • 35. DEVELOPING REACTIVE MICROSERVICES HTTP://BIT.LY/DEVELOPREACTIVEMICROSERVICE > create base services, expose endpoints, and then connect them with a simple, web-based user interface > deal with persistence, state, and clients > Use integration technologies to start a successful migration away from legacy systems
  • 36. NEXT STEPS Project Site: http://www.lightbend.com/lagom GitHub Repo: https://github.com/lagom Documentation: http://www.lagomframework.com/documentation/1.0.x/ Home.html