Post on 09-Jan-2017
LagomReactive microservices framework
Fabrice Sznajderman - @fsznajderman16 septembre 2016 @lagom #JSC2016
Roadmap
● Microservices / Event Sourcing / CQRS
● Lagom : overview
● Principales fonctionnalités
● Anatomie d’un projet
● Live coding
● Next step
Qui vous parle?
Fabrice Sznajderman
● Développeur Scala @Zenika○ Formateur Java/Scala
● Contributeur (Lagom, JHipster, rapture)● Bagger (Scala - Lagom - SBT)
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
CQRS
Write (Command) :Event log. Modèle simple.
Read (Query) : Dénormalisation, scalabillité, performance...
● 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● Play framework● Guice● Akka : Persistence, Pub/Sub, cluster● Akka Stream● SLF4J & Logback
Overview - Composants techniques
● Description de l’API basée sur une interface
● Request / response synchrone
● Message asynchrone - Streaming
Fonctionnalités - Service API
● 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
● 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
● ConductR pour la production
● Scalabilité
● Déploiement
● Monitoring
Fonctionnalités - Environnement Production
● Activator
● Plugin SBT: *scaffolding-plugin-lagom
Structure d’un projet - Démarrer un projet
*https://github.com/Fabszn/scaffolding-plugin-lagom
Structure d’un projet - Démarrage du système
● Une commande pour lancer le système : sbt runAll
● Plusieurs services activés au démarrage : ○ Cassandra
○ Service locator
○ service gateway
○ tous les services déclarés
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