lagom, reactive framework

36
Lagom Reactive microservices framework Fabrice Sznajderman - @fsznajderman 16 septembre 2016 @lagom #JSC2016

Upload: fabrice-sznajderman

Post on 09-Jan-2017

160 views

Category:

Technology


0 download

TRANSCRIPT

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)

October 27th and 28th, 2016. Lyon, France

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

CQRS

Write (Command) :Event log. Modèle simple.

Read (Query) : Dénormalisation, scalabillité, performance...

CQRS

Lagom

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● Play framework● Guice● Akka : Persistence, Pub/Sub, cluster● Akka Stream● SLF4J & Logback

Overview - Composants techniques

Principales fonctionnalités

● 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

Anatomie d’un projet

● 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 - Arborescence

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

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!