SlideShare a Scribd company logo
1 of 78
Download to read offline
LagomReactive microservices framework
#NightClazz @Lagom
12/05/16
Fabrice Sznajderman
@fsznajderman
Agenda
● Core concepts
● Lagom framework
● Hands on Lagom
Who I am?
Fabrice Sznajderman
○ Java/Scala/Web developer
■ Java/Scala trainer
■ Co-organizer of Scala IO 2016
■ Contributor on Lagom
● BrownBagLunch.fr
Chapter 1
Core
Concepts
Agenda
● Microservices architecture
● CQRS
● Event Sourcing
Core concepts
Core concepts
Microservices
Architecture
Monolithic vs Microservices
Monolithic issues
● All features are concentrated
in one app
● One technology used (silver
bullet?)
● Complexity rising over time
● new comers have difficulties to
dive into code base
Microservices-based
Architecture
Reactive Microservices Architecture: Design Principles for Distributed Systems - James Boner http:
//www.oreilly.com/programming/free/reactive-microservices-architecture.html
Microservices-Based Architecture is a simple concept: it
advocates creating a system from a collection of small,
isolated services, each of which owns their data, and is
independently isolated, scalable and resilient to
failure.
Services integrate with other services in order to form a
cohesive system that’s far more flexible than the typical
enterprise systems we build today.
What is a microservice?
Standalone component
What is a microservice?
Isolated
What is a microservice?
Own its data
What is a microservice?
Located microservice
What is a microservice?
Communication by asynchronous message
What is a good microservice ?
Answer with 3 questions ...
Question 1
Does my service do only one thing?
If you can state a microservice’s full
purpose with a short sentence, your
service is OK!
“This service manages users’
accounts”
Question 2
Is my service autonomous?
A service should be responsible
for its own behavior. It shouldn’t
rely on other services to do its
job.
“An autonomous service would accept the
any request regardless of the status of
others services.”
Question 3
Does this service own its own data?
A service “owns” data if it is the
sole writer and the sole reader of
the database where the data lives
“Data can be accessed only throught the
service interface, no directly”
Anti-pattern
● Adapted use-case?
● Transactionnal
● Distributed monolithic layers
● “Don’t Repeat Yourself”
● Shared data repository
That implies challenges
● Organisational impacts
● Monitoring of services
● Locating service
● Test strategy
● Distributed development
environment
Reading
Reactive Microservices Architecture by Jonas Boner
CQRS
Core concepts
CQRS stands for
● Command
● Query
● Responsability
● Segregation
Traditional approach
Traditional approach
● Using the same model for read
and write
● Read & write have different
needs
○ Representation of data can
take several forms
○ Update side contains
validation rules
● All together rises complexity
● Performance issues
Write : Normalization,
consistency, transactional...
Read : Denormalization,
scalability, performance...
Needs between read and write are not the
same.
http://martinfowler.com/bliki/CommandQuerySeparation.html
Facts
Command : Change the state of a
system but do not return a value
Queries : Return a result and do
not change the observable state
of the system (are free of side
effects)
Principle is that we divide our model into two
sharply separated categories:
http://martinfowler.com/bliki/CommandQuerySeparation.html
CQRS approach
CQRS approach
CQRS approah
● Each model are on
○ separate logicals processes
○ separate hardware
● Database :
○ shared
○ unique per model
● Unique model with differente
interfaces
Several manners to implement
Other architecture
CQRS approah
● Not a silver bullet, every case
doesn’t fit with this CQRS
approach.
● Doesn’t apply CQRS on whole
system, only be used on specific
portions of system (bounded
context - DDD)
Cautions
Next
CQRS design fits well with Event
Sourcing pattern...
Event
Sourcing
Core concepts
Traditional approah
Active record
Traditional approah
Active record
Traditional approah
● Only final state is captured
● Debugability & tracability not
really easy
● Complexity with mapping O & R
● Performance issue (update)
How we have reached this state?
Active record
Event Sourcing approach
● Don't update the current state
of objects
● Save the events that lead to the
current state
Different approach
Event Sourcing approach
● Complete log of every state
change
● Debugability & tracability
come easy
● Good performance (commit
log)
and more …
Benefits
● Complete rebuild
● Temporal query
● Event replay
Event Sourcing approach
More benefits
● Commands are going to change the
state (or not)
● Each state change creates an event
● Order of events must be preserved
Event Sourcing approach
How does it works?
● Command’s name describe an action
to do (imperative)
● Event’s name describe an action in
the past
Event Sourcing approach
Remarks
Event Sourcing approach
Restore
state into model
Event Sourcing approach
Deleting an object
Update the query side with deletion of
bank account.
Event Sourcing approach
Snapshot
● Several events will be created
● Restore all events to reach one state
might be expensive
● To avoid this, we use a snapshot
Lagom
Framework
Chapter 2
Agenda
● Big picture of Lagom
● Project structure
● My first microservice
Lagom framework
Big picture
of Lagom
Big picture of Lagom
First of all, … Lagom pronounce :
What is Lagom?
● Microservices framework for a
system of microservices
● Based on the Reactive principles
● A fully integrated development
environment
Which language?
● Core of framework written in
Scala
● Developments are in Java
● Scala version migth be available
soon
Main features
● Service API
● Persistence API
● Development Environment
● Production Environment
Service API
● Interface as descriptor
● Defined API of exposed services
● Synchronous request/response
● Asynchronous streaming
message
Persistence API
● Provides event-sourced
persisted entities
● CQRS Read side
● Entry point for events handlers
Development Environment
● One command to start all
services
● Hot reload of your code
● Several services provided out of
the box
● IDE Integration
Production Environment
● ConductR for production
environment
● Scaling
● Deployment
● Monitoring
Communication protocols
● Polyglot systems
● HTTP, WebSocket, JSON are
standards
● can consumed
● can be consumed
Component technologies
● Collection of technologies
● Some come from Lightbend
● Others are third-party and
open-source
Component technologies
● Java 8 (& Scala)
● Immutables
● SBT
● Jackson
● Cassandra
● Play framework
● Guice
● Akka : Persistence, Pub/Sub,
cluster
● Akka Stream : Streaming part
● SLF4J & Logback
● Asynchronous & non blocking as
default
● Distributed persistence : ES /
CQRS as default
● Circuit breaker (as default)
● Productivity for developers :
Expressive service interface
Design philosophy
Project
Structure
with Lagom
Activator
activator sampleProject lagom-java
● Engine provided by Lightbend
● Create project from template
● Template name for Lagom: lagom-java
● Activator must be installed apart
● Generated a new project :
Project tree
SBT build file
● Project configuration
● Describe all modules
● Describe all dependencies per module
● Host all parameters for project
○ cassandra
○ service locator
○ etc
Service declaration
● One service is composed of 2 sub-
projects
○ API
○ Implementation
● Implementation depends on API
SBT build file
organization in ThisBuild := "sample.helloworld"
// the Scala version that will be used for cross-
compiled libraries
scalaVersion in ThisBuild := "2.11.7"
lazy val helloworldApi = project("helloworld-api")
.settings(
version := "1.0-SNAPSHOT",
libraryDependencies += lagomJavadslApi
)
lazy val helloworldImpl = project("helloworld-impl")
.enablePlugins(LagomJava)
.settings(
version := "1.0-SNAPSHOT",
libraryDependencies ++= Seq(
lagomJavadslPersistence,
lagomJavadslTestKit
)
)
.settings(lagomForkedTestSettings: _*)
.dependsOn(helloworldApi)
Service imported
● One service could be imported as
dependency
● Just declare it and it will start as others
Launch services
● One command to launch all Lagom’s
service : sbt runAll
● Several services are launched
○ Cassandra
○ Service locator
○ service gateway
○ All services that you declared
Launch one service
● One command to launch one Lagom’s
service : sbt project_name/run
● no more services are launched
● One service Locator must be available
apart.
Locator service
● All services register on this locator
● By default, one service locator is started
● It can be started apart
Cassandra embedded
● One instance of Cassandra is started by
default
● It can be unactivate if no persistence is
required
● It can be started apart
● Cassandra’s client can be used to
explore tables
Mapping of one Service
Write a
service
with Lagom
Demo
Here, we will see :
○ Global configuration of project
○ Service Interface - Descriptor
○ Related implementation
○ All stuffs linked with persistence (CQRS-EventSourcing)
Just an information !
● 5 days ago, the API has change !!!
ServiceCall<Id,Request, Response>
interface ServiceCall<Request, Response> {
CompletionStage<Response> invoke(Request request);
//others methods
}
Ok, now we can dive into dark side...code! ;)
Thank you!
Next …
Hands on!
Chapter 3
Lagom : Reactive microservice framework

More Related Content

What's hot

React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIMarcin Grzywaczewski
 
Building Services with WSO2 Microservices Framework for Java
Building Services with WSO2 Microservices Framework for JavaBuilding Services with WSO2 Microservices Framework for Java
Building Services with WSO2 Microservices Framework for JavaSanjeewa Malalgoda
 
Exposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIsExposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIsWSO2
 
What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6WSO2
 
Java 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
Java 8: Nashorn & avatar.js di Enrico Risa al JUG RomaJava 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
Java 8: Nashorn & avatar.js di Enrico Risa al JUG RomaVitalij Zadneprovskij
 
Dynamic management of kubernetes
Dynamic management of kubernetesDynamic management of kubernetes
Dynamic management of kubernetesMartin Podval
 
2016_04_04_CNI_Spring_Meeting_Microservices
2016_04_04_CNI_Spring_Meeting_Microservices2016_04_04_CNI_Spring_Meeting_Microservices
2016_04_04_CNI_Spring_Meeting_MicroservicesJason Varghese
 
Levelling up in Akka
Levelling up in AkkaLevelling up in Akka
Levelling up in AkkaSigmoid
 
Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015Rubén Mondéjar Andreu
 
istio: service mesh for all
istio: service mesh for allistio: service mesh for all
istio: service mesh for allMandar Jog
 
Micronaut Deep Dive - Devoxx Belgium 2019
Micronaut Deep Dive - Devoxx Belgium 2019Micronaut Deep Dive - Devoxx Belgium 2019
Micronaut Deep Dive - Devoxx Belgium 2019graemerocher
 
Introduction to the Nancy Framework
Introduction to the Nancy FrameworkIntroduction to the Nancy Framework
Introduction to the Nancy FrameworkTim Bourguignon
 
MongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableMongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableFlowable
 
Debugging Grails Database Performance
Debugging Grails Database PerformanceDebugging Grails Database Performance
Debugging Grails Database PerformanceEnergized Work
 
Slick eventsourcing
Slick eventsourcingSlick eventsourcing
Slick eventsourcingAdam Warski
 
Type-safe front-end development with Scala
Type-safe front-end development with ScalaType-safe front-end development with Scala
Type-safe front-end development with Scalatakezoe
 

What's hot (20)

React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UI
 
Building Services with WSO2 Microservices Framework for Java
Building Services with WSO2 Microservices Framework for JavaBuilding Services with WSO2 Microservices Framework for Java
Building Services with WSO2 Microservices Framework for Java
 
Dropwizard
DropwizardDropwizard
Dropwizard
 
Power tools in Java
Power tools in JavaPower tools in Java
Power tools in Java
 
Exposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIsExposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIs
 
What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6
 
Java 9 and Project Jigsaw
Java 9 and Project JigsawJava 9 and Project Jigsaw
Java 9 and Project Jigsaw
 
Java 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
Java 8: Nashorn & avatar.js di Enrico Risa al JUG RomaJava 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
Java 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
 
Dynamic management of kubernetes
Dynamic management of kubernetesDynamic management of kubernetes
Dynamic management of kubernetes
 
2016_04_04_CNI_Spring_Meeting_Microservices
2016_04_04_CNI_Spring_Meeting_Microservices2016_04_04_CNI_Spring_Meeting_Microservices
2016_04_04_CNI_Spring_Meeting_Microservices
 
Levelling up in Akka
Levelling up in AkkaLevelling up in Akka
Levelling up in Akka
 
Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
 
istio: service mesh for all
istio: service mesh for allistio: service mesh for all
istio: service mesh for all
 
Micronaut Deep Dive - Devoxx Belgium 2019
Micronaut Deep Dive - Devoxx Belgium 2019Micronaut Deep Dive - Devoxx Belgium 2019
Micronaut Deep Dive - Devoxx Belgium 2019
 
Introduction to the Nancy Framework
Introduction to the Nancy FrameworkIntroduction to the Nancy Framework
Introduction to the Nancy Framework
 
MongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableMongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with Flowable
 
Debugging Grails Database Performance
Debugging Grails Database PerformanceDebugging Grails Database Performance
Debugging Grails Database Performance
 
Slick eventsourcing
Slick eventsourcingSlick eventsourcing
Slick eventsourcing
 
Type-safe front-end development with Scala
Type-safe front-end development with ScalaType-safe front-end development with Scala
Type-safe front-end development with Scala
 

Viewers also liked

Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Fabrice Sznajderman
 
Lagom, reactive framework(paris jug2017)
Lagom, reactive framework(paris jug2017)Lagom, reactive framework(paris jug2017)
Lagom, reactive framework(paris jug2017)Fabrice Sznajderman
 
Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Balanced Team
 
ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroDragos Dascalita
 
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014Anthony Chen
 
Developing Applications with a Micro Service Architecture - Chris Richardson
Developing Applications with a Micro Service Architecture - Chris RichardsonDeveloping Applications with a Micro Service Architecture - Chris Richardson
Developing Applications with a Micro Service Architecture - Chris RichardsonJAXLondon2014
 
Best Practices Building Cloud Scale Apps with Microservices
Best Practices Building Cloud Scale Apps with MicroservicesBest Practices Building Cloud Scale Apps with Microservices
Best Practices Building Cloud Scale Apps with MicroservicesJim (张建军) Zhang
 
Disruptors Don't Play By The Rules
Disruptors Don't Play By The RulesDisruptors Don't Play By The Rules
Disruptors Don't Play By The RulesReuven Gorsht
 
Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15Kevin Buckley
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.usjclingan
 
Maven c'est bien, SBT c'est mieux
Maven c'est bien, SBT c'est mieuxMaven c'est bien, SBT c'est mieux
Maven c'est bien, SBT c'est mieuxFabrice Sznajderman
 
Java EE Microservices
Java EE MicroservicesJava EE Microservices
Java EE Microservicesjclingan
 
Microservice architecture design principles
Microservice architecture design principlesMicroservice architecture design principles
Microservice architecture design principlesSanjoy Kumar Roy
 
Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010JUG Lausanne
 

Viewers also liked (20)

Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016) Lagom, reactive framework(chtijug2016)
Lagom, reactive framework(chtijug2016)
 
Lagom, reactive framework(paris jug2017)
Lagom, reactive framework(paris jug2017)Lagom, reactive framework(paris jug2017)
Lagom, reactive framework(paris jug2017)
 
Lagom, reactive framework
Lagom, reactive frameworkLagom, reactive framework
Lagom, reactive framework
 
Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...
 
ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices Hero
 
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
 
Developing Applications with a Micro Service Architecture - Chris Richardson
Developing Applications with a Micro Service Architecture - Chris RichardsonDeveloping Applications with a Micro Service Architecture - Chris Richardson
Developing Applications with a Micro Service Architecture - Chris Richardson
 
Best Practices Building Cloud Scale Apps with Microservices
Best Practices Building Cloud Scale Apps with MicroservicesBest Practices Building Cloud Scale Apps with Microservices
Best Practices Building Cloud Scale Apps with Microservices
 
Disruptors Don't Play By The Rules
Disruptors Don't Play By The RulesDisruptors Don't Play By The Rules
Disruptors Don't Play By The Rules
 
Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15Microservices - firststatedot.net - 13-oct-15
Microservices - firststatedot.net - 13-oct-15
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.us
 
Maven c'est bien, SBT c'est mieux
Maven c'est bien, SBT c'est mieuxMaven c'est bien, SBT c'est mieux
Maven c'est bien, SBT c'est mieux
 
Universitélang scala tools
Universitélang scala toolsUniversitélang scala tools
Universitélang scala tools
 
Les monades Scala, Java 8
Les monades Scala, Java 8Les monades Scala, Java 8
Les monades Scala, Java 8
 
Java EE Microservices
Java EE MicroservicesJava EE Microservices
Java EE Microservices
 
Université des langages scala
Université des langages   scalaUniversité des langages   scala
Université des langages scala
 
Scala Intro
Scala IntroScala Intro
Scala Intro
 
Microservice architecture design principles
Microservice architecture design principlesMicroservice architecture design principles
Microservice architecture design principles
 
Cloud Security
Cloud Security Cloud Security
Cloud Security
 
Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010
 

Similar to Lagom : Reactive microservice framework

Introduction to Lagom Framework
Introduction to Lagom FrameworkIntroduction to Lagom Framework
Introduction to Lagom FrameworkKnoldus Inc.
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...OdessaJS Conf
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideMohanraj Thirumoorthy
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendVlad Fedosov
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JSFestUA
 
Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On Ram G Suri
 
Microservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesMicroservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesQAware GmbH
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMiki Lombardi
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kuberneteskloia
 
Migrating from oracle soa suite to microservices on kubernetes
Migrating from oracle soa suite to microservices on kubernetesMigrating from oracle soa suite to microservices on kubernetes
Migrating from oracle soa suite to microservices on kubernetesKonveyor Community
 
Feature Development with jQuery
Feature Development with jQueryFeature Development with jQuery
Feature Development with jQueryMichael Edwards
 
Red Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionRed Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionJohn Archer
 
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)Binary Studio
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Deepu K Sasidharan
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterJulien Dubois
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsPiyush Katariya
 
170215 msa intro
170215 msa intro170215 msa intro
170215 msa introSonic leigh
 
Microservices at ibotta pitfalls and learnings
Microservices at ibotta pitfalls and learningsMicroservices at ibotta pitfalls and learnings
Microservices at ibotta pitfalls and learningsMatthew Reynolds
 
Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015aspyker
 

Similar to Lagom : Reactive microservice framework (20)

Introduction to Lagom Framework
Introduction to Lagom FrameworkIntroduction to Lagom Framework
Introduction to Lagom Framework
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On
 
Microservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesMicroservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing Microservices
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - Plansoft
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Migrating from oracle soa suite to microservices on kubernetes
Migrating from oracle soa suite to microservices on kubernetesMigrating from oracle soa suite to microservices on kubernetes
Migrating from oracle soa suite to microservices on kubernetes
 
Feature Development with jQuery
Feature Development with jQueryFeature Development with jQuery
Feature Development with jQuery
 
Red Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionRed Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus Introduction
 
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipster
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise Applications
 
170215 msa intro
170215 msa intro170215 msa intro
170215 msa intro
 
Libreplan architecture
Libreplan architectureLibreplan architecture
Libreplan architecture
 
Microservices at ibotta pitfalls and learnings
Microservices at ibotta pitfalls and learningsMicroservices at ibotta pitfalls and learnings
Microservices at ibotta pitfalls and learnings
 
Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

Lagom : Reactive microservice framework

  • 1. LagomReactive microservices framework #NightClazz @Lagom 12/05/16 Fabrice Sznajderman @fsznajderman
  • 2. Agenda ● Core concepts ● Lagom framework ● Hands on Lagom
  • 3. Who I am? Fabrice Sznajderman ○ Java/Scala/Web developer ■ Java/Scala trainer ■ Co-organizer of Scala IO 2016 ■ Contributor on Lagom ● BrownBagLunch.fr
  • 5. Agenda ● Microservices architecture ● CQRS ● Event Sourcing Core concepts
  • 8. Monolithic issues ● All features are concentrated in one app ● One technology used (silver bullet?) ● Complexity rising over time ● new comers have difficulties to dive into code base
  • 9. Microservices-based Architecture Reactive Microservices Architecture: Design Principles for Distributed Systems - James Boner http: //www.oreilly.com/programming/free/reactive-microservices-architecture.html Microservices-Based Architecture is a simple concept: it advocates creating a system from a collection of small, isolated services, each of which owns their data, and is independently isolated, scalable and resilient to failure. Services integrate with other services in order to form a cohesive system that’s far more flexible than the typical enterprise systems we build today.
  • 10. What is a microservice? Standalone component
  • 11. What is a microservice? Isolated
  • 12. What is a microservice? Own its data
  • 13. What is a microservice? Located microservice
  • 14. What is a microservice? Communication by asynchronous message
  • 15. What is a good microservice ? Answer with 3 questions ...
  • 16. Question 1 Does my service do only one thing? If you can state a microservice’s full purpose with a short sentence, your service is OK! “This service manages users’ accounts”
  • 17. Question 2 Is my service autonomous? A service should be responsible for its own behavior. It shouldn’t rely on other services to do its job. “An autonomous service would accept the any request regardless of the status of others services.”
  • 18. Question 3 Does this service own its own data? A service “owns” data if it is the sole writer and the sole reader of the database where the data lives “Data can be accessed only throught the service interface, no directly”
  • 19. Anti-pattern ● Adapted use-case? ● Transactionnal ● Distributed monolithic layers ● “Don’t Repeat Yourself” ● Shared data repository
  • 20. That implies challenges ● Organisational impacts ● Monitoring of services ● Locating service ● Test strategy ● Distributed development environment
  • 23. CQRS stands for ● Command ● Query ● Responsability ● Segregation
  • 25. Traditional approach ● Using the same model for read and write ● Read & write have different needs ○ Representation of data can take several forms ○ Update side contains validation rules ● All together rises complexity ● Performance issues
  • 26. Write : Normalization, consistency, transactional... Read : Denormalization, scalability, performance... Needs between read and write are not the same. http://martinfowler.com/bliki/CommandQuerySeparation.html Facts
  • 27. Command : Change the state of a system but do not return a value Queries : Return a result and do not change the observable state of the system (are free of side effects) Principle is that we divide our model into two sharply separated categories: http://martinfowler.com/bliki/CommandQuerySeparation.html CQRS approach
  • 29. CQRS approah ● Each model are on ○ separate logicals processes ○ separate hardware ● Database : ○ shared ○ unique per model ● Unique model with differente interfaces Several manners to implement
  • 31. CQRS approah ● Not a silver bullet, every case doesn’t fit with this CQRS approach. ● Doesn’t apply CQRS on whole system, only be used on specific portions of system (bounded context - DDD) Cautions
  • 32. Next CQRS design fits well with Event Sourcing pattern...
  • 36. Traditional approah ● Only final state is captured ● Debugability & tracability not really easy ● Complexity with mapping O & R ● Performance issue (update) How we have reached this state? Active record
  • 37. Event Sourcing approach ● Don't update the current state of objects ● Save the events that lead to the current state Different approach
  • 38. Event Sourcing approach ● Complete log of every state change ● Debugability & tracability come easy ● Good performance (commit log) and more … Benefits
  • 39. ● Complete rebuild ● Temporal query ● Event replay Event Sourcing approach More benefits
  • 40. ● Commands are going to change the state (or not) ● Each state change creates an event ● Order of events must be preserved Event Sourcing approach How does it works?
  • 41. ● Command’s name describe an action to do (imperative) ● Event’s name describe an action in the past Event Sourcing approach Remarks
  • 43. Event Sourcing approach Deleting an object Update the query side with deletion of bank account.
  • 44. Event Sourcing approach Snapshot ● Several events will be created ● Restore all events to reach one state might be expensive ● To avoid this, we use a snapshot
  • 46. Agenda ● Big picture of Lagom ● Project structure ● My first microservice Lagom framework
  • 48. Big picture of Lagom First of all, … Lagom pronounce :
  • 49. What is Lagom? ● Microservices framework for a system of microservices ● Based on the Reactive principles ● A fully integrated development environment
  • 50. Which language? ● Core of framework written in Scala ● Developments are in Java ● Scala version migth be available soon
  • 51. Main features ● Service API ● Persistence API ● Development Environment ● Production Environment
  • 52. Service API ● Interface as descriptor ● Defined API of exposed services ● Synchronous request/response ● Asynchronous streaming message
  • 53. Persistence API ● Provides event-sourced persisted entities ● CQRS Read side ● Entry point for events handlers
  • 54. Development Environment ● One command to start all services ● Hot reload of your code ● Several services provided out of the box ● IDE Integration
  • 55. Production Environment ● ConductR for production environment ● Scaling ● Deployment ● Monitoring
  • 56. Communication protocols ● Polyglot systems ● HTTP, WebSocket, JSON are standards ● can consumed ● can be consumed
  • 57. Component technologies ● Collection of technologies ● Some come from Lightbend ● Others are third-party and open-source
  • 58. Component technologies ● Java 8 (& Scala) ● Immutables ● SBT ● Jackson ● Cassandra ● Play framework ● Guice ● Akka : Persistence, Pub/Sub, cluster ● Akka Stream : Streaming part ● SLF4J & Logback
  • 59. ● Asynchronous & non blocking as default ● Distributed persistence : ES / CQRS as default ● Circuit breaker (as default) ● Productivity for developers : Expressive service interface Design philosophy
  • 61. Activator activator sampleProject lagom-java ● Engine provided by Lightbend ● Create project from template ● Template name for Lagom: lagom-java ● Activator must be installed apart ● Generated a new project :
  • 63. SBT build file ● Project configuration ● Describe all modules ● Describe all dependencies per module ● Host all parameters for project ○ cassandra ○ service locator ○ etc
  • 64. Service declaration ● One service is composed of 2 sub- projects ○ API ○ Implementation ● Implementation depends on API
  • 65. SBT build file organization in ThisBuild := "sample.helloworld" // the Scala version that will be used for cross- compiled libraries scalaVersion in ThisBuild := "2.11.7" lazy val helloworldApi = project("helloworld-api") .settings( version := "1.0-SNAPSHOT", libraryDependencies += lagomJavadslApi ) lazy val helloworldImpl = project("helloworld-impl") .enablePlugins(LagomJava) .settings( version := "1.0-SNAPSHOT", libraryDependencies ++= Seq( lagomJavadslPersistence, lagomJavadslTestKit ) ) .settings(lagomForkedTestSettings: _*) .dependsOn(helloworldApi)
  • 66. Service imported ● One service could be imported as dependency ● Just declare it and it will start as others
  • 67. Launch services ● One command to launch all Lagom’s service : sbt runAll ● Several services are launched ○ Cassandra ○ Service locator ○ service gateway ○ All services that you declared
  • 68. Launch one service ● One command to launch one Lagom’s service : sbt project_name/run ● no more services are launched ● One service Locator must be available apart.
  • 69. Locator service ● All services register on this locator ● By default, one service locator is started ● It can be started apart
  • 70. Cassandra embedded ● One instance of Cassandra is started by default ● It can be unactivate if no persistence is required ● It can be started apart ● Cassandra’s client can be used to explore tables
  • 71. Mapping of one Service
  • 73. Demo Here, we will see : ○ Global configuration of project ○ Service Interface - Descriptor ○ Related implementation ○ All stuffs linked with persistence (CQRS-EventSourcing)
  • 74. Just an information ! ● 5 days ago, the API has change !!! ServiceCall<Id,Request, Response> interface ServiceCall<Request, Response> { CompletionStage<Response> invoke(Request request); //others methods }
  • 75. Ok, now we can dive into dark side...code! ;)