SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
Lagom
Reactive microservices framework
Lagom
Reactive microservices framework
Fabrice Sznajderman - @fsznajderman
24 novembre 2016 @lagom
Roadmap
● Microservices / Event Sourcing / CQRS
● Overview
● Principales fonctionnalités
● Live coding
● Next step
Qui vous parle?
Fabrice Sznajderman
● Développeur Scala @Zenika
○ Formateur Java/Scala
● Contributeur (Lagom, JHipster, rapture)
● Bagger (Scala - Lagom - SBT)
● Co-organisateur ScalaIO
Core concepts
Microservices / Event Sourcing / CQRS
Microservices
Microservices
Microservices
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.
Reactive Microservices Architecture: Design Principles for Distributed Systems - James Boner
http://www.oreilly.com/programming/free/reactive-microservices-architecture.html
Microservices
Event Sourcing
Approche traditionnelle
Approche traditionnelle
Approche traditionnelle
Event sourcing
CQRS
CQRS
● Command
● Query
● Responsability
● Segregation
Approche traditionelle
Write (Command) :
Event log. Modèle simple.
Read (Query) :
Dénormalisation, scalabillité, performance...
CQRS
CQRS
Lagom
Overview / Principales fonctionnalités / Live coding
Overview
● Construire un système de microservices
● Basé sur les principes réactifs
● Intégration dans l’environnement de développement
Overview - Objectifs
● Coeur du framework est écrit en Scala
● API en Java 8
● Bientôt une version Scala
Overview - Quel langage ?
● Java 8 (& Scala)
● (Immutables)
● SBT / Maven
● Jackson
● Cassandra / JDBC*
● Message broker* (Kafka)
● Play framework
● Akka : persistence, pub/Sub, cluster
● Akka Stream
Overview - Composants techniques
*depuis la version 1.2.0
Principales fonctionnalités
● Description de l’API basée sur une interface
● Request / response synchrone
● Message asynchrone - Streaming
Fonctionnalités - Service API
Fonctionnalités - Service API
public interface HelloWorldService extends Service {
ServiceCall<NotUsed, String> hi(String name);
@Override
default Descriptor descriptor() {
return named("helloWorld").withCalls(restCall(Method.GET, "/hello/:name", this::hi));
}
}
● Garde l’état courant en mémoire
● Capture et persiste tous les changements d’états (events)
● CQRS Read side (query & update)
● Clustering / sharding
● CassandraSession
Fonctionnalités - Persistance API
Fonctionnalités - Persistance API
public class UserEntity extends PersistentEntity<UserCommand, UserEvent, UsersState> {
@Override
public Behavior initialBehavior(Optional<UsersState> snapshotState) {
BehaviorBuilder b = newBehaviorBuilder(
snapshotState.orElse(new UsersState(UsersList.builder().build(), "now")));
b.setCommandHandler(
UserCommand.SignIn.class,
(cmd, ctx) -> ctx.thenPersist(new UserSigned(cmd.name), evt -> ctx.reply(Done.getInstance())));
b.setEventHandler(
UserSigned.class,
evt -> {
/*get information from event and update state*/
final UsersList newState = /*current update state*/;
return new UsersState(newState, LocalDateTime.now().toString());
});
b.setReadOnlyCommandHandler(UserCommand.ListUsers.class,
(cmd, ctx) -> ctx.reply(state().users.getUsers()));
return b.build();
}
}
● ConductR pour la production
● Scalabilité
● Déploiement
● Monitoring
Fonctionnalités - Environnement Production
● Intégration dans l’IDE
● Plusieurs services fournis par défaut
● Rechargement du code à chaud
● Une seule commande pour démarrer le système
Fonctionnalités - Environnement de développement
Structure d’un projet - Démarrage du système
● Une commande pour lancer le système :
○ sbt runAll / mvn runAll
● Plusieurs services activés au démarrage :
○ Cassandra
○ Service locator
○ Service gateway
○ Tous les services déclarés
Live coding
Next step
● [Documentation] http://www.lagomframework.com
● [Gitter] https://gitter.im/lagom/lagom
● [Github] https://github.com/lagom/lagom
● [Plugin] https://github.com/Fabszn/scaffolding-plugin-lagom
Merci!

Más contenido relacionado

La actualidad más candente

Mongo db applicationmonitor
Mongo db applicationmonitorMongo db applicationmonitor
Mongo db applicationmonitor
Philippe Sfeir
 
Presentation cloud&drinks
Presentation cloud&drinksPresentation cloud&drinks
Presentation cloud&drinks
Ikoula
 

La actualidad más candente (8)

[JSS2015] - Document db et nosql
[JSS2015] - Document db et nosql[JSS2015] - Document db et nosql
[JSS2015] - Document db et nosql
 
[AFUP Lyon 2021] LDAP Tool Box Self Service Password
[AFUP Lyon 2021] LDAP Tool Box Self Service Password[AFUP Lyon 2021] LDAP Tool Box Self Service Password
[AFUP Lyon 2021] LDAP Tool Box Self Service Password
 
Mongo db applicationmonitor
Mongo db applicationmonitorMongo db applicationmonitor
Mongo db applicationmonitor
 
[Campus du Libre 2020] Présentation de la solution W'Sweet
[Campus du Libre 2020] Présentation de la solution W'Sweet[Campus du Libre 2020] Présentation de la solution W'Sweet
[Campus du Libre 2020] Présentation de la solution W'Sweet
 
Presentation cloud&drinks
Presentation cloud&drinksPresentation cloud&drinks
Presentation cloud&drinks
 
Les micro orm, alternatives à entity framework
Les micro orm, alternatives à entity frameworkLes micro orm, alternatives à entity framework
Les micro orm, alternatives à entity framework
 
I don't always write reactive application but when I do, it run on raspberry pi
I don't always write reactive application but when I do, it run on raspberry piI don't always write reactive application but when I do, it run on raspberry pi
I don't always write reactive application but when I do, it run on raspberry pi
 
Beta 12c
Beta 12cBeta 12c
Beta 12c
 

Destacado

Paris stormusergroup intrudocution
Paris stormusergroup intrudocutionParis stormusergroup intrudocution
Paris stormusergroup intrudocution
Paris_Storm_UG
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008
Yardena Meymann
 

Destacado (20)

Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice framework
 
Lagom, reactive framework(paris jug2017)
Lagom, reactive framework(paris jug2017)Lagom, reactive framework(paris jug2017)
Lagom, reactive framework(paris jug2017)
 
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
 
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
 
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
 
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
 
Bimodal / Two Speed IT and Cloud Serverless Microservice Architecture
Bimodal / Two Speed IT and Cloud Serverless Microservice ArchitectureBimodal / Two Speed IT and Cloud Serverless Microservice Architecture
Bimodal / Two Speed IT and Cloud Serverless Microservice Architecture
 
Scala in Action - Heiko Seeburger
Scala in Action - Heiko SeeburgerScala in Action - Heiko Seeburger
Scala in Action - Heiko Seeburger
 
Paris stormusergroup intrudocution
Paris stormusergroup intrudocutionParis stormusergroup intrudocution
Paris stormusergroup intrudocution
 
Getting Functional with Scala
Getting Functional with ScalaGetting Functional with Scala
Getting Functional with Scala
 
Introduction to Spark with Scala
Introduction to Spark with ScalaIntroduction to Spark with Scala
Introduction to Spark with Scala
 
Soutenance ysance
Soutenance ysanceSoutenance ysance
Soutenance ysance
 
Hammurabi
HammurabiHammurabi
Hammurabi
 
Scala - A Scalable Language
Scala - A Scalable LanguageScala - A Scalable Language
Scala - A Scalable Language
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008
 

Similar a Lagom, reactive framework(chtijug2016)

Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Jean-Laurent de Morlhon
 
Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...
Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...
Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...
LINAGORA
 

Similar a Lagom, reactive framework(chtijug2016) (20)

Le Cloud IaaS & PaaS, OpenStack réseau et sécurité
Le Cloud IaaS & PaaS, OpenStack réseau et sécuritéLe Cloud IaaS & PaaS, OpenStack réseau et sécurité
Le Cloud IaaS & PaaS, OpenStack réseau et sécurité
 
Bbl microservices avec vert.x cdi elastic search
Bbl microservices avec vert.x cdi elastic searchBbl microservices avec vert.x cdi elastic search
Bbl microservices avec vert.x cdi elastic search
 
Saas Libre
Saas LibreSaas Libre
Saas Libre
 
Panel de solutions javascript
Panel de solutions javascriptPanel de solutions javascript
Panel de solutions javascript
 
Architecture microservices avec docker
Architecture microservices avec dockerArchitecture microservices avec docker
Architecture microservices avec docker
 
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
 
Architecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependancesArchitecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependances
 
Scub Foundation, usine logicielle Java libre
Scub Foundation, usine logicielle Java libreScub Foundation, usine logicielle Java libre
Scub Foundation, usine logicielle Java libre
 
Introduction à Cloud Foundry et au PaaS
Introduction à Cloud Foundry et au PaaSIntroduction à Cloud Foundry et au PaaS
Introduction à Cloud Foundry et au PaaS
 
Open source et microsoft azure reve ou realite ?
Open source et microsoft azure reve ou realite ?Open source et microsoft azure reve ou realite ?
Open source et microsoft azure reve ou realite ?
 
Java dans Windows Azure: l'exemple de Jonas
Java dans Windows Azure: l'exemple de JonasJava dans Windows Azure: l'exemple de Jonas
Java dans Windows Azure: l'exemple de Jonas
 
Infrastructure - Monitoring - Cacti
Infrastructure - Monitoring - CactiInfrastructure - Monitoring - Cacti
Infrastructure - Monitoring - Cacti
 
Architecture de services web de type ressource
Architecture de services web de type ressourceArchitecture de services web de type ressource
Architecture de services web de type ressource
 
Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...
Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...
Séminaire septembre 2010 - LinID et LinPKI, Les solutions Open Source d'ident...
 
Java entreprise edition et industrialisation du génie logiciel par m.youssfi
Java entreprise edition et industrialisation du génie logiciel par m.youssfiJava entreprise edition et industrialisation du génie logiciel par m.youssfi
Java entreprise edition et industrialisation du génie logiciel par m.youssfi
 
Meetup - Construire des applications serverless avec Azure
Meetup - Construire des applications serverless avec AzureMeetup - Construire des applications serverless avec Azure
Meetup - Construire des applications serverless avec Azure
 
Gab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir Arezki
Gab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir ArezkiGab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir Arezki
Gab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir Arezki
 
Gab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir Arezki
Gab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir ArezkiGab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir Arezki
Gab 2017 Lyon - les strategies d'intégration avec Azure iPaaS - Samir Arezki
 
CV REBAI Hamida
CV REBAI HamidaCV REBAI Hamida
CV REBAI Hamida
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les bases
 

Lagom, reactive framework(chtijug2016)

  • 1. Lagom Reactive microservices framework Lagom Reactive microservices framework Fabrice Sznajderman - @fsznajderman 24 novembre 2016 @lagom
  • 2. Roadmap ● Microservices / Event Sourcing / CQRS ● Overview ● Principales fonctionnalités ● Live coding ● Next step
  • 3. Qui vous parle? Fabrice Sznajderman ● Développeur Scala @Zenika ○ Formateur Java/Scala ● Contributeur (Lagom, JHipster, rapture) ● Bagger (Scala - Lagom - SBT) ● Co-organisateur ScalaIO
  • 4. Core concepts Microservices / Event Sourcing / CQRS
  • 7. Microservices 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. Reactive Microservices Architecture: Design Principles for Distributed Systems - James Boner http://www.oreilly.com/programming/free/reactive-microservices-architecture.html
  • 14. CQRS
  • 15. CQRS ● Command ● Query ● Responsability ● Segregation
  • 17. Write (Command) : Event log. Modèle simple. Read (Query) : Dénormalisation, scalabillité, performance... CQRS
  • 18. CQRS
  • 19. Lagom Overview / Principales fonctionnalités / Live coding
  • 21. ● Construire un système de microservices ● Basé sur les principes réactifs ● Intégration dans l’environnement de développement Overview - Objectifs
  • 22. ● Coeur du framework est écrit en Scala ● API en Java 8 ● Bientôt une version Scala Overview - Quel langage ?
  • 23. ● Java 8 (& Scala) ● (Immutables) ● SBT / Maven ● Jackson ● Cassandra / JDBC* ● Message broker* (Kafka) ● Play framework ● Akka : persistence, pub/Sub, cluster ● Akka Stream Overview - Composants techniques *depuis la version 1.2.0
  • 25. ● Description de l’API basée sur une interface ● Request / response synchrone ● Message asynchrone - Streaming Fonctionnalités - Service API
  • 26. Fonctionnalités - Service API public interface HelloWorldService extends Service { ServiceCall<NotUsed, String> hi(String name); @Override default Descriptor descriptor() { return named("helloWorld").withCalls(restCall(Method.GET, "/hello/:name", this::hi)); } }
  • 27. ● Garde l’état courant en mémoire ● Capture et persiste tous les changements d’états (events) ● CQRS Read side (query & update) ● Clustering / sharding ● CassandraSession Fonctionnalités - Persistance API
  • 28. Fonctionnalités - Persistance API public class UserEntity extends PersistentEntity<UserCommand, UserEvent, UsersState> { @Override public Behavior initialBehavior(Optional<UsersState> snapshotState) { BehaviorBuilder b = newBehaviorBuilder( snapshotState.orElse(new UsersState(UsersList.builder().build(), "now"))); b.setCommandHandler( UserCommand.SignIn.class, (cmd, ctx) -> ctx.thenPersist(new UserSigned(cmd.name), evt -> ctx.reply(Done.getInstance()))); b.setEventHandler( UserSigned.class, evt -> { /*get information from event and update state*/ final UsersList newState = /*current update state*/; return new UsersState(newState, LocalDateTime.now().toString()); }); b.setReadOnlyCommandHandler(UserCommand.ListUsers.class, (cmd, ctx) -> ctx.reply(state().users.getUsers())); return b.build(); } }
  • 29. ● ConductR pour la production ● Scalabilité ● Déploiement ● Monitoring Fonctionnalités - Environnement Production
  • 30. ● Intégration dans l’IDE ● Plusieurs services fournis par défaut ● Rechargement du code à chaud ● Une seule commande pour démarrer le système Fonctionnalités - Environnement de développement
  • 31. Structure d’un projet - Démarrage du système ● Une commande pour lancer le système : ○ sbt runAll / mvn runAll ● Plusieurs services activés au démarrage : ○ Cassandra ○ Service locator ○ Service gateway ○ Tous les services déclarés
  • 33. Next step ● [Documentation] http://www.lagomframework.com ● [Gitter] https://gitter.im/lagom/lagom ● [Github] https://github.com/lagom/lagom ● [Plugin] https://github.com/Fabszn/scaffolding-plugin-lagom