how lagom helps - meetupfiles.meetup.com/6295162/microservices come in systems.pdfhow to design...
TRANSCRIPT
![Page 1: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/1.jpg)
HOW LAGOM HELPSTO BUILD REAL WORLDMICROSERVICE SYSTEMS
![Page 3: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/3.jpg)
@Path("/orders/")@Interceptors(CallAudit.class)@Stateless public class OrderService {
@EJB BillingService billing; @EJB DeliveryService delivery; @EJB Warehouse warehouse;
@PUT @Produces({"application/xml","application/json"}) @Consumes({"application/xml","application/json"}) public Order order(Order newOrder){ Order order = warehouse.checkout(newOrder); billing.payForOrder(order); delivery.deliver(order); return order; }
@GET @Path("{orderid}/") @Produces({"application/xml","application/json"}) public Order status(@PathParam("orderid") long orderId){ return delivery.status(orderId); }}
![Page 4: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/4.jpg)
![Page 5: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/5.jpg)
@Path("/orders/")@Interceptors(CallAudit.class)@Stateless public class OrderService {
private Client client; private WebTarget tut;
// ...
@GET @Path("{orderid}/") @Produces({"application/xml","application/json"}) public Order status(@PathParam("orderid") long orderId){ // return delivery.status(orderId); this.client = ClientBuilder.newClient(); this.tut = this.client.target("http://..."); Order order = this.client.target(location).request(MediaType.APPLICATION_XML).get(Order.class); return order; }}
![Page 6: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/6.jpg)
BUILDING ONE MICROSERVICE IS GENERALLY EASY.
WHAT IS HARD IS BUILDING A SYSTEM OF MICROSERVICES.
![Page 7: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/7.jpg)
COMPLEX DEPLOYMENT
![Page 8: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/8.jpg)
LARGE TEAMS
![Page 9: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/9.jpg)
BREAKING UP MONOLITHS ADDS COMPLEXITY
![Page 10: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/10.jpg)
WHICH TECHNOLOGY TO CHOOSE?
![Page 11: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/11.jpg)
DATA IN MOTION
Rather than acting on data at rest, modern software increasingly operates on data in near real-time.
![Page 12: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/12.jpg)
Traditional application architectures
and platforms are obsolete.— Gartner
![Page 13: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/13.jpg)
WE USED THE RIGHT TOOLS TO BUILD THE WRONG
THINGS.
![Page 14: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/14.jpg)
AND WE STILL ARE MISSING TOOLS.
> Service Discovery> Service Lookup> API Management
> Security> Protocols and Interfaces
> Data Access> Developer Experience
![Page 15: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/15.jpg)
PROTOCOLS AND INTERFACES
REST tends to be our go-to but…> Don’t just do a 1:1 service/interface replacement
> Instead… Design for an asynchronous architecture
Pro-tip: Watch Ben Christensen’s “Don’t build a distributed Monolith” talk from Microservices Practitioner Summit
2016
![Page 16: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/16.jpg)
Architectureand software design principles
matter even more today.— Eisele
![Page 17: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/17.jpg)
HOW TO DESIGN MICROSERVICES SYSTEMS
> Single Responsible Principle> Service Oriented Architecture
> Encapsulation> Separation of Concern
> Loose Coupling> Hexagonal Architecture
![Page 18: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/18.jpg)
SOFTWARE DESIGN PATTERNS
> Domain-driven Design> Bounded Contexts
> Event Sourcing> CQRS
> Eventual Consistency> Context Maps
![Page 19: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/19.jpg)
WE NEED TO BUILD SYSTEMS FOR FLEXIBILITY
AND RESILIENCY, NOT JUST EFFICIENCY AND
ROBUSTNESS.
![Page 20: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/20.jpg)
CORE TENANTS
> Responsive
> Resilient
> Elastic
> Message driven
![Page 21: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/21.jpg)
HOW LAGOM CAN HELP
> Developer experience first!> No ad-hoc scripts to run your
services> Takes you through to production
deployment
![Page 22: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/22.jpg)
HIGHLY OPINIONATED
> Use context bounds as boundaries for services!(Domain Driven Design)
> The event log is the book of record!(Event Sourcing)
> Separate the read and write sides! (CQRS)
> Microservices, too, need to be elastic and resilient!
![Page 23: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/23.jpg)
LAGOM SERVICE API
> IO and communication> Streaming between services as a first-class concept
> Higher level of resilience and scalability with no blocking
> Service is a Bounded Context in DDD> Service Clients & Endpoints
![Page 24: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/24.jpg)
LAGOM PERSISTENCE API
> Event sourced (deltas) with Cassandra backend by default
> No object/relational impedance mismatch> Can always replay to determine current state> Allows you to learn more from your data later> Persistent entity is an Aggregate Root in DDD
> Can be overridden for CRUD if you want
![Page 25: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/25.jpg)
![Page 26: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/26.jpg)
![Page 27: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/27.jpg)
DEVELOPMENT ENVIRONMENT$ cd my-first-system$ activator... (booting up)> runAll[info] Starting embedded Cassandra server..........[info] Cassandra server running at 127.0.0.1:4000[info] Service locator is running at http://localhost:8000[info] Service gateway is running at http://localhost:9000[info] Service helloworld-impl listening for HTTP on 0:0:0:0:0:0:0:0:24266[info] Service hellostream-impl listening for HTTP on 0:0:0:0:0:0:0:0:26230(Services started, use Ctrl+D to stop and go back to the console...)
![Page 28: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/28.jpg)
WHAT IS TECHNICALLY IN LAGOM?
> sbt build tool> Scala 2.11 and JDK8
> Play 2.5> Akka 2.4
> Cassandra> Jackson
> Google Guice
![Page 29: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/29.jpg)
INTEGRATION WITH LAGOM
![Page 30: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/30.jpg)
NEXT STEPS FOR LAGOM
> Scala API> Swagger integration
> Maven support> Support for more DBs
> Integration with other cluster orchestration tools
> … What is missing?
![Page 31: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/31.jpg)
CARGO TRACKER EXAMPLE
https://github.com/lagom/activator-lagom-cargotracker
![Page 32: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/32.jpg)
![Page 33: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/33.jpg)
LEARN ABOUT LAGOM
Lagom on GitHubLagom Mailinglist
@LagomChat Room
![Page 34: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/34.jpg)
REACTIVE MICROSERVICES ARCHITECTURE
BIT.LY/REACTIVEMICROSERVICE
> explore a microservice architecture> based on Reactive principles
> for building an isolated service that’s
> scalable, resilient to failure,> and combines with other services
> to form a cohesive whole
![Page 35: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/35.jpg)
DEVELOPING REACTIVE MICROSERVICES
HTTP://BIT.LY/DEVELOPREACTIVEMICROSERVICE
> create base services, expose endpoints, and then connect them
with a simple, web-based user interface
> deal with persistence, state, and clients
> Use integration technologies to start a successful migration away
from legacy systems
![Page 36: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/36.jpg)
NEXT STEPS
Project Site:http://www.lightbend.com/lagom
GitHub Repo:https://github.com/lagom
Documentation:http://www.lagomframework.com/documentation/1.0.x/
java/Home.html
![Page 37: HOW LAGOM HELPS - Meetupfiles.meetup.com/6295162/Microservices Come in Systems.pdfHOW TO DESIGN MICROSERVICES SYSTEMS > Single Responsible Principle > Service Oriented Architecture](https://reader035.vdocument.in/reader035/viewer/2022070710/5ec6d8ae6d19d35476326be5/html5/thumbnails/37.jpg)