Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
BASLE BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA
HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURIC...
Agenda
Introduction to Lagom2 9/23/2016
1. What is Lagom?
Overview
Running in Produktion
2. Lagom Framework
Features
Under...
Introduction to Lagom3 9/23/2016
What is Lagom?
Overview
Introduction to Lagom4 9/23/2016
Lightbend, formerly Typesafe
Open Source / most part in Scala
Swedish word [lah-...
Running in Production
Introduction to Lagom5 9/23/2016
sbt-native packager is used to produce zip, MSI, RPM, Docker
Lightb...
ConductR* / Reactive Plattform
Introduction to Lagom6 9/23/2016
source: http://thenewstack.io/lightbends-lagom-offers-micr...
Service Locator / Gateway
Introduction to Lagom7 9/23/2016
Service Locator
– discovers services and allows to communicate
...
Similar products like ConductR*
Introduction to Lagom8 9/23/2016
Cloud Foundry
Kubernetes / Vert.x
…
Introduction to Lagom9 9/23/2016
Lagom Framework
Features
Introduction to Lagom10 9/23/2016
Lagom is a framework for creating microservice-based systems. It offers four ma...
Principles
Introduction to Lagom11 9/23/2016
Each service owns its data
Only the service has direct access to the DB
Its a...
ES / CQRS
Introduction to Lagom12 9/23/2016
Event Sourcing (ES)
– Capture all state’s changes as events
Command Query Resp...
Benefits of ES / CQRS
Introduction to Lagom13 9/23/2016
Allows you to time travel
Audit log
Future business opportunities
...
Under the hood
Introduction to Lagom14 9/23/2016
Current version 1.0.0
– Java API, but no Scala API yet
sbt build tool (de...
Future Roadmap
Introduction to Lagom15 9/23/2016
Maven support
Support for other cluster orchestration tools
– new project...
Lagom design philosophy
Introduction to Lagom16 9/23/2016
Asynchronous by default, both IO and communication
Reactive Micr...
Lagom core concepts
Introduction to Lagom17 9/23/2016
Tools and APIs
Good architecture
Microservices concepts and best pra...
Introduction to Lagom18 9/23/2016
Lagom API
Anatomy of a Lagom project
Introduction to Lagom19 9/23/2016
sbt build
Scala 2.11 and JDK8
Each service definition is spli...
ServiceCall explained
Introduction to Lagom20 9/23/2016
ServiceCall can be invoked when consuming a service:
– Request: ty...
Strict Messages
Introduction to Lagom21 9/23/2016
ServiceCall<FriendId, NotUsed> addFriend(String userId);
@Override
defau...
Streamed Messages
Introduction to Lagom22 9/23/2016
A streamed message is of type Source (an Akka streams API)
– e.g. chat...
Event Sourcing: Write Side
Introduction to Lagom23 9/23/2016
Create your own Command and Event classes
– Command: system h...
Event Sourcing: Read Side
Introduction to Lagom24 9/23/2016
Tightly integrated with Cassandra
Create the query tables:
– S...
Introduction to Lagom25 9/23/2016
Demo
Chirper
Introduction to Lagom26 9/23/2016
Friend: handels users and relation among them.
Chirp: allows to create and retri...
Introduction to Lagom27 9/23/2016
Lagom: http://www.lagomframework.com/
Lagom Git: https://github.com/lagom/lagom
Lagom Ch...
Thomas Graf
Consultant
Tel. +41 58 459 53 38
thomas.graf@trivadis.com
9/23/2016 Introduction to Lagom28
Session Feedback – now
TechEvent September 201629 09.09.2016
Please use the Trivadis Events Mobile App to give session fee...
Nächste SlideShare
Wird geladen in …5
×

Trivadis TechEvent 2016 Introduction to Lagom - another microservice-based framework by Thomas Graf

151 Aufrufe

Veröffentlicht am

Lagom is a microservice-based framework. Its four main features (Service API / Persistence API / Development and Production Environment) will be introduced. Lagom's main goal is to create new microservices and then launch them all with a single command. Code deployments become instantly visible. Furthermore, Lagom supports distributed persistent patterns as Event Sourcing (ES) with Command Query Responsability Segregation (CQRS), in contrast to the traditional centralized database.

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Trivadis TechEvent 2016 Introduction to Lagom - another microservice-based framework by Thomas Graf

  1. 1. BASLE BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH Introduction to Lagom another microservice-based framework Thomas Graf Consultant
  2. 2. Agenda Introduction to Lagom2 9/23/2016 1. What is Lagom? Overview Running in Produktion 2. Lagom Framework Features Under the hood / Future Roadmap Lagom design philosophy / Lagom core concepts 3. Lagom API Anatomy of a Lagom project ServiceCall explained 4. Demo
  3. 3. Introduction to Lagom3 9/23/2016 What is Lagom?
  4. 4. Overview Introduction to Lagom4 9/23/2016 Lightbend, formerly Typesafe Open Source / most part in Scala Swedish word [lah-gome] – enough, sufficient, adequate, just right  just the right amount
  5. 5. Running in Production Introduction to Lagom5 9/23/2016 sbt-native packager is used to produce zip, MSI, RPM, Docker Lightbend ConductR* (container orchestration tool) – Free during development Lightbend Reactive Platform – Split Brain Resolver (for Akka cluster) – Lightbend Monitoring – Requires a Lightbend subscription
  6. 6. ConductR* / Reactive Plattform Introduction to Lagom6 9/23/2016 source: http://thenewstack.io/lightbends-lagom-offers-microservice-framework-java-developers/
  7. 7. Service Locator / Gateway Introduction to Lagom7 9/23/2016 Service Locator – discovers services and allows to communicate Service Gateway – Querying different services – No direct access to endpoint – Acts as a proxy; services have a different port Result: running on the same port and assigned constantly Idea: ConductR* is scalable because of Service Gateway
  8. 8. Similar products like ConductR* Introduction to Lagom8 9/23/2016 Cloud Foundry Kubernetes / Vert.x …
  9. 9. Introduction to Lagom9 9/23/2016 Lagom Framework
  10. 10. Features Introduction to Lagom10 9/23/2016 Lagom is a framework for creating microservice-based systems. It offers four main features: Service API Persistence API Development environment Production environment (introduction well documented)
  11. 11. Principles Introduction to Lagom11 9/23/2016 Each service owns its data Only the service has direct access to the DB Its advocated to use Event Sourcing (ES) and CQRS – Out of the box / optimized – Highly opinionated on that subject
  12. 12. ES / CQRS Introduction to Lagom12 9/23/2016 Event Sourcing (ES) – Capture all state’s changes as events Command Query Responsibility Segregation (CQRS) – separate models for write and read Idea: substitute for transactions in distributed systems 1 2 3 n…
  13. 13. Benefits of ES / CQRS Introduction to Lagom13 9/23/2016 Allows you to time travel Audit log Future business opportunities No need for ORM No database migration script, ever Performance & Scalability Testability & Debuggability
  14. 14. Under the hood Introduction to Lagom14 9/23/2016 Current version 1.0.0 – Java API, but no Scala API yet sbt build tool (developer) / Activator 1.3.10 Play 2.5 Akka 2.4 (clustering, streams, persistence) Cassandra (default data store) Jackson (JSON serialization) Guice (Dependency Injection) Architectural concepts: immutability, circuit breakers, Event Sourcing (ES) / CQRS (Command Query Responsibility Segregation)
  15. 15. Future Roadmap Introduction to Lagom15 9/23/2016 Maven support Support for other cluster orchestration tools – new project / module for Kubernetes Swagger integration – Which also removes binary coupling! Support for writing integration tests Message broker integration Scala API
  16. 16. Lagom design philosophy Introduction to Lagom16 9/23/2016 Asynchronous by default, both IO and communication Reactive Microservice Architecture, report by Jonas Bonér Distributed persistence High productivity
  17. 17. Lagom core concepts Introduction to Lagom17 9/23/2016 Tools and APIs Good architecture Microservices concepts and best practice
  18. 18. Introduction to Lagom18 9/23/2016 Lagom API
  19. 19. Anatomy of a Lagom project Introduction to Lagom19 9/23/2016 sbt build Scala 2.11 and JDK8 Each service definition is split into two sbt projects: – API – Implementation
  20. 20. ServiceCall explained Introduction to Lagom20 9/23/2016 ServiceCall can be invoked when consuming a service: – Request: type of incoming request message (e.g. String) – Response: type of outgoing response message (e.g. String) JSON is the default serialization format for request/response messages There are two kinds of request/response messages: – Strict – Streamed interface ServiceCall<Request, Response> { CompletionStage<Response> invoke(Request request); }
  21. 21. Strict Messages Introduction to Lagom21 9/23/2016 ServiceCall<FriendId, NotUsed> addFriend(String userId); @Override default Descriptor descriptor() { return named("friendservice").withCalls( pathCall("/api/users/:userId/friends", this::addFriend), ).withAutoAcl(true); } Strict messages are fully buffered into memory – e.g. create a user  after transaction information are not needed anymore
  22. 22. Streamed Messages Introduction to Lagom22 9/23/2016 A streamed message is of type Source (an Akka streams API) – e.g. chat  stream message and forget; cached on client side It allows asynchronous streaming and handling of messages Lagom will select transport protocol (currently WebSockets) ServiceCall<NotUsed, Source<Chirp, ?>> getLiveActivityStream(String userId); @Override default Descriptor descriptor() { return named("activityservice").withCalls( pathCall("/api/activity/:userId/live", this::getLiveActivityStream) ).withAutoAcl(true); }
  23. 23. Event Sourcing: Write Side Introduction to Lagom23 9/23/2016 Create your own Command and Event classes – Command: system has to do, may trigger an event – Event: system has done (past), is stored Subclass PersistentEntity – Define Command and Event handlers – Can be accessed from anywhere in the cluster
  24. 24. Event Sourcing: Read Side Introduction to Lagom24 9/23/2016 Tightly integrated with Cassandra Create the query tables: – Subclass CassandraReadSideProcessor – Consumers events produced by the PersistentEntity and updates tables in Cassandra optimized for queries Retrieving data: Cassandra Query Language – e.g., SELECT id, title FROM postsummary
  25. 25. Introduction to Lagom25 9/23/2016 Demo
  26. 26. Chirper Introduction to Lagom26 9/23/2016 Friend: handels users and relation among them. Chirp: allows to create and retrieve chrips (i.e., messages). ActivityStream: allows to retrieve history or live chrips of a user Frontend: Play + Javascript UI
  27. 27. Introduction to Lagom27 9/23/2016 Lagom: http://www.lagomframework.com/ Lagom Git: https://github.com/lagom/lagom Lagom Chriper: https://github.com/lagom/activator-lagom-java-chirper Report by Jonas Bonér, free book, Reactive Service Architecture: http://www.oreilly.com/programming/free/reactive-microservices-architecture.html
  28. 28. Thomas Graf Consultant Tel. +41 58 459 53 38 thomas.graf@trivadis.com 9/23/2016 Introduction to Lagom28
  29. 29. Session Feedback – now TechEvent September 201629 09.09.2016 Please use the Trivadis Events Mobile App to give session feedback Use "My schedule" if you registered for this session Otherwise use "Agenda" and the search function If the mobile App does not work (or if you have a Windows Phone) use your Mobile Browser – URL: http://trivadis.quickmobileplatform.eu/ – Username: <your_loginname> (like svv) – Password: sent by mail...

×