SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Lari Hotari @lhotari
Pivotal Software, Inc.
Ratpack and
Grails 3
Agenda
• Grails 3 and Ratpack
• Why async?
• Modularity and micro service architectures
• Embrace Gradle
• Abstract packaging / deployment
• Reach outside the servlet container
• App profiles: Netty, Servlet, Batch, Hadoop
• Lightweight deployments, support micro
services
Grails 3
Why Netty / Ratpack?
Why async?
Amdahl's law
Programming model
• Declarative programming expresses the logic of
a computation without describing its control flow.
• It's programming without the call stack, the
programmer doesn't decide execution details.
• Examples: functional and reactive
programming, event / message based
execution, distributed parallel computation
algorithms like Map/Reduce
15 import ratpack.rx.RxRatpack
16 import ratpack.session.SessionModule
17 import ratpack.session.store.MapSessionsModule
18 import ratpack.session.store.SessionStorage
19
20 import static ratpack.groovy.Groovy.groovyTemplate
21 import static ratpack.groovy.Groovy.ratpack
22 import static ratpack.jackson.Jackson.json
23 import static ratpack.pac4j.internal.SessionConstants.USER_PROFILE
24
25 ratpack {
26 bindings {
27 bind DatabaseHealthCheck
28 add new CodaHaleMetricsModule().jvmMetrics().jmx().websocket().
29 healthChecks()
30 add new HikariModule([URL: "jdbc:h2:mem:dev;INIT=CREATE SCHEMA IF NOT
31 EXISTS DEV"], "org.h2.jdbcx.JdbcDataSource")
32 add new SqlModule()
33 add new JacksonModule()
34 add new BookModule()
35 add new RemoteControlModule()
36 add new SessionModule()
37 add new MapSessionsModule(10, 5)
38 add new Pac4jModule<>(new FormClient("/login", new
39 SimpleTestUsernamePasswordAuthenticator()), new
40 AuthPathAuthorizer())
41
42 init { BookService bookService ->
43 RxRatpack.initialize()
44 HystrixRatpack.initialize()
45 bookService.createTable()
46 }
47 }
48
49 handlers { BookService bookService ->
50
51 get {
52 bookService.all().toList().subscribe { List<Book> books ->
53 SessionStorage sessionStorage = request.get(SessionStorage)
54 UserProfile profile = sessionStorage.get(USER_PROFILE)
55 def username = profile?.getAttribute("username")
56
57 render groovyTemplate("listing.html",
58 username: username ?: "",
59 title: "Books",
60 books: books,
61 msg: request.queryParams.msg ?: "")
62 }
63 }
64
65 handler("create") {
66 byMethod {
67 get {
68 render groovyTemplate("create.html", title: "Create Book")
69 }
70 post {
71 Form form = parse(Form)
72 bookService.insert(
73 form.isbn,
74 form.get("quantity").asType(Long),
75 form.get("price").asType(BigDecimal)
76 ).single().subscribe { String isbn ->
77 redirect "/?msg=Book+$isbn+created"
78 }
79 }
80 }
81 }
82
83 handler("update/:isbn") {
84 def isbn = pathTokens["isbn"]
85
86 bookService.find(isbn).single().subscribe { Book book ->
87 if (book == null) {
88 clientError(404)
89 } else {
90 byMethod {
91 get {
92 render groovyTemplate("update.html", title:
93 "Update Book", book: book)
94 }
95 post {
96 Form form = parse(Form)
97 bookService.update(
98 isbn,
99 form.get("quantity").asType(Long),
100 form.get("price").asType(BigDecimal)
101 ) subscribe {
102 redirect "/?msg=Book+$isbn+updated"
103 }
104 }
105 }
106 }
107 }
108 }
109
110 post("delete/:isbn") {
111 def isbn = pathTokens["isbn"]
112 bookService.delete(isbn).subscribe {
113 redirect "/?msg=Book+$isbn+deleted"
114 }
115 }
116
117 prefix("api") {
118 get("books") {
119 bookService.all().toList().subscribe { List<Book> books ->
120 render json(books)
121 }
122 }
123
124 handler("book/:isbn?", registry.get(BookRestEndpoint))
81 }
82
83 handler("update/:isbn") {
84 def isbn = pathTokens["isbn"]
85
86 bookService.find(isbn).single().subscribe { Book book ->
87 if (book == null) {
88 clientError(404)
89 } else {
90 byMethod {
91 get {
92 render groovyTemplate("update.html", title:
93 "Update Book", book: book)
94 }
95 post {
96 Form form = parse(Form)
97 bookService.update(
98 isbn,
99 form.get("quantity").asType(Long),
100 form.get("price").asType(BigDecimal)
101 ) subscribe {
102 redirect "/?msg=Book+$isbn+updated"
103 }
104 }
105 }
106 }
107 }
108 }
109
110 post("delete/:isbn") {
111 def isbn = pathTokens["isbn"]
112 bookService.delete(isbn).subscribe {
113 redirect "/?msg=Book+$isbn+deleted"
source: https://github.com/ratpack/example-books/blob/master/src/ratpack/Ratpack.groovy
Ratpack application
consists of
functional handler
chains
Ratpack applications
• Ratpacks comes with Guice for dependency injection
• Guice modules are also used as the plugin system for
Ratpack
• Examples of Ratpack module contributions:
• Integrations to RxJava and Reactor. Can be used for
async composition and preventing "callback hell".
• Integration to Netflix Hystrix for adding error resilience
functionality . f.e., Circuit-breaker pattern impl.
Demo
Ratpack and Grails (GORM) used together
• https://github.com/lhotari/ratpack-gorm-example
• Spring Boot embedded in Ratpack, running
GORM
Modularity
• logical partitioning of the "software design"
• allows complex software to be manageable for
the purpose of implementation and maintenance
Coupling and Cohesion
• Coupling and cohesion are measures for
describing how easy it will be to change the
behaviour of some element in a system
• Modules are coupled if a change in one forces a
change in a the other
• A module's cohesion is a measure of whether it's
responsibilities form a meaningful unit
source: GOOS book
• Low coupling between modules ⟹ easier to
change
• High cohesion within module ⟹ single
responsibility
Microservice definition
by James Lewis
• Each application only does one thing
• Small enough to fit in your head
• Small enough that you can throw them away
• Embedded web container
• Packaged as a single executable jar
• Use HTTP and HATEOAS to decouple services
• Each app exposes metrics about itself
–Arnon Rotem-Gal-Oz, Practical SOA
“Nanoservice is an Anti-pattern where a
service is too fine grained. Nanoservice is a
service whose overhead (communications,
maintenance etc.) out-weights its utility.”
Polygot persistence
• Common principle is that each service owns it's data -
there is no shared database across multiple services.
• If this principle is followed, it usually means switching
to Hexagonal architecture, where persistence is an
integration and not part of the core.
• "Start with the events and behaviour instead of the
database."
• Data consistency models in distributed systems
Brooks: "No silver bullet"
• Essential complexity
• complexity that you cannot escape
• Accidental complexity
• we could be adding complexity by bad design
- Google's "Solve for X"
“You don't spend your time
being bothered that you can't
teleport from here to Japan,
because there's a part of you
that thinks it's impossible. !
Moonshot thinking is choosing
to be bothered by that.”
Modular monoliths
• Modular monoliths are composed of loosely coupled
modules of single responsibility
• Enabling the 3rd way (after monoliths and
microservices) for building applications on the JVM
across different libraries and frameworks
• Modules can be turned into true micro services when
needed - instead of introducing accidental complexity
to projects that don't really require micro services in
the beginning, but could benefit of them later
The monoliths in the micro
services architecture
Single Page
App in
Browser
API Gateway
service
µservice
A
SAAS Service
A
SAAS Service
B
µservice
B
µservice
C
µservice
D
µservice
E
µservice
F
"If you built it..."
 pretotyping.org
“Make sure you are building the
right it before you build it right."
!
"Fail fast ... and Often"
Lari Hotari @lhotari
Pivotal Software, Inc.
Thank you!

Más contenido relacionado

La actualidad más candente

Implementing MySQL Database-as-a-Service using open source tools
Implementing MySQL Database-as-a-Service using open source toolsImplementing MySQL Database-as-a-Service using open source tools
Implementing MySQL Database-as-a-Service using open source toolsAll Things Open
 
stackconf 2021 | Prometheus in 2021 and beyond
stackconf 2021 | Prometheus in 2021 and beyondstackconf 2021 | Prometheus in 2021 and beyond
stackconf 2021 | Prometheus in 2021 and beyondNETWAYS
 
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETESKUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETESAlex Soto
 
[Lakmal] Automate Microservice to API
[Lakmal] Automate Microservice to API[Lakmal] Automate Microservice to API
[Lakmal] Automate Microservice to APILakmal Warusawithana
 
stackconf 2021 | How we finally migrated an eCommerce-Platform to GCP
stackconf 2021 | How we finally migrated an eCommerce-Platform to GCPstackconf 2021 | How we finally migrated an eCommerce-Platform to GCP
stackconf 2021 | How we finally migrated an eCommerce-Platform to GCPNETWAYS
 
The what, why and how of knative
The what, why and how of knativeThe what, why and how of knative
The what, why and how of knativeMofizur Rahman
 
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)Red Hat Developers
 
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...Red Hat Developers
 
Knative, Serverless on Kubernetes, and Openshift
Knative, Serverless on Kubernetes, and OpenshiftKnative, Serverless on Kubernetes, and Openshift
Knative, Serverless on Kubernetes, and OpenshiftChris Suszyński
 
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...Red Hat Developers
 
CNCF Keynote - What is cloud native?
CNCF Keynote - What is cloud native?CNCF Keynote - What is cloud native?
CNCF Keynote - What is cloud native?Weaveworks
 
Creating a Kubernetes Operator in Java
Creating a Kubernetes Operator in JavaCreating a Kubernetes Operator in Java
Creating a Kubernetes Operator in JavaRudy De Busscher
 
Building Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring CloudBuilding Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring CloudGeekNightHyderabad
 
Containers & Cloud Native Ops Cloud Foundry Approach
Containers & Cloud Native Ops Cloud Foundry ApproachContainers & Cloud Native Ops Cloud Foundry Approach
Containers & Cloud Native Ops Cloud Foundry ApproachCodeOps Technologies LLP
 
Netflix OSS Meetup Season 4 Episode 4
Netflix OSS Meetup Season 4 Episode 4Netflix OSS Meetup Season 4 Episode 4
Netflix OSS Meetup Season 4 Episode 4aspyker
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with javaDPC Consulting Ltd
 
The Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitThe Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitWeaveworks
 
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
Deploying Anything as a Service (XaaS) Using Operators on KubernetesDeploying Anything as a Service (XaaS) Using Operators on Kubernetes
Deploying Anything as a Service (XaaS) Using Operators on KubernetesAll Things Open
 
Kubernetes fundamentals
Kubernetes fundamentalsKubernetes fundamentals
Kubernetes fundamentalsVictor Morales
 

La actualidad más candente (20)

Implementing MySQL Database-as-a-Service using open source tools
Implementing MySQL Database-as-a-Service using open source toolsImplementing MySQL Database-as-a-Service using open source tools
Implementing MySQL Database-as-a-Service using open source tools
 
stackconf 2021 | Prometheus in 2021 and beyond
stackconf 2021 | Prometheus in 2021 and beyondstackconf 2021 | Prometheus in 2021 and beyond
stackconf 2021 | Prometheus in 2021 and beyond
 
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETESKUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES
 
[Lakmal] Automate Microservice to API
[Lakmal] Automate Microservice to API[Lakmal] Automate Microservice to API
[Lakmal] Automate Microservice to API
 
stackconf 2021 | How we finally migrated an eCommerce-Platform to GCP
stackconf 2021 | How we finally migrated an eCommerce-Platform to GCPstackconf 2021 | How we finally migrated an eCommerce-Platform to GCP
stackconf 2021 | How we finally migrated an eCommerce-Platform to GCP
 
The what, why and how of knative
The what, why and how of knativeThe what, why and how of knative
The what, why and how of knative
 
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
 
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
 
Knative, Serverless on Kubernetes, and Openshift
Knative, Serverless on Kubernetes, and OpenshiftKnative, Serverless on Kubernetes, and Openshift
Knative, Serverless on Kubernetes, and Openshift
 
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
 
CNCF Keynote - What is cloud native?
CNCF Keynote - What is cloud native?CNCF Keynote - What is cloud native?
CNCF Keynote - What is cloud native?
 
Microservices with Spring
Microservices with SpringMicroservices with Spring
Microservices with Spring
 
Creating a Kubernetes Operator in Java
Creating a Kubernetes Operator in JavaCreating a Kubernetes Operator in Java
Creating a Kubernetes Operator in Java
 
Building Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring CloudBuilding Cloud Native Applications Using Spring Boot and Spring Cloud
Building Cloud Native Applications Using Spring Boot and Spring Cloud
 
Containers & Cloud Native Ops Cloud Foundry Approach
Containers & Cloud Native Ops Cloud Foundry ApproachContainers & Cloud Native Ops Cloud Foundry Approach
Containers & Cloud Native Ops Cloud Foundry Approach
 
Netflix OSS Meetup Season 4 Episode 4
Netflix OSS Meetup Season 4 Episode 4Netflix OSS Meetup Season 4 Episode 4
Netflix OSS Meetup Season 4 Episode 4
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with java
 
The Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitThe Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps Toolkit
 
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
Deploying Anything as a Service (XaaS) Using Operators on KubernetesDeploying Anything as a Service (XaaS) Using Operators on Kubernetes
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
 
Kubernetes fundamentals
Kubernetes fundamentalsKubernetes fundamentals
Kubernetes fundamentals
 

Destacado

Introduction to Groovy Monkey
Introduction to Groovy MonkeyIntroduction to Groovy Monkey
Introduction to Groovy Monkeyjervin
 
Ratpack and Grails 3
Ratpack and Grails 3Ratpack and Grails 3
Ratpack and Grails 3Lari Hotari
 
High Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring BootHigh Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring BootDaniel Woods
 
Intranet: un modelo para la transformación digital de la organización
Intranet: un modelo para la transformación digital de la organizaciónIntranet: un modelo para la transformación digital de la organización
Intranet: un modelo para la transformación digital de la organizaciónMaximiliano Gonzalez-Fierro
 
Sap amazon and Kogent Demo
Sap amazon and Kogent DemoSap amazon and Kogent Demo
Sap amazon and Kogent DemoJon Boutelle
 
PSBJ - Accelerating Sales Without a Marketing Budget
PSBJ - Accelerating Sales Without a Marketing BudgetPSBJ - Accelerating Sales Without a Marketing Budget
PSBJ - Accelerating Sales Without a Marketing BudgetHeinz Marketing Inc
 
Salesforce1 data gov lunch anaheim deck
Salesforce1 data gov lunch anaheim deckSalesforce1 data gov lunch anaheim deck
Salesforce1 data gov lunch anaheim deckBeth Fitzpatrick
 
Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”
Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”
Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”SiteGround España
 
83 solid pancreatic masses on computed tomography
83 solid pancreatic masses on computed tomography83 solid pancreatic masses on computed tomography
83 solid pancreatic masses on computed tomographyDr. Muhammad Bin Zulfiqar
 
Task Management: 11 Tips for Effective Management
Task Management: 11 Tips for Effective ManagementTask Management: 11 Tips for Effective Management
Task Management: 11 Tips for Effective ManagementArun Agrawal
 
2015 South By Southwest Sports: #SXSports Insights
2015 South By Southwest Sports: #SXSports Insights2015 South By Southwest Sports: #SXSports Insights
2015 South By Southwest Sports: #SXSports InsightsNeil Horowitz
 
美次級房貸風暴的影響評估
美次級房貸風暴的影響評估美次級房貸風暴的影響評估
美次級房貸風暴的影響評估Obadiah
 
EIT-Digital_Annual-Report-2015-Digital-Version
EIT-Digital_Annual-Report-2015-Digital-VersionEIT-Digital_Annual-Report-2015-Digital-Version
EIT-Digital_Annual-Report-2015-Digital-VersionEdna Ayme-Yahil, PhD
 

Destacado (17)

Introduction to Groovy Monkey
Introduction to Groovy MonkeyIntroduction to Groovy Monkey
Introduction to Groovy Monkey
 
Ratpack and Grails 3
Ratpack and Grails 3Ratpack and Grails 3
Ratpack and Grails 3
 
High Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring BootHigh Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring Boot
 
Intranet: un modelo para la transformación digital de la organización
Intranet: un modelo para la transformación digital de la organizaciónIntranet: un modelo para la transformación digital de la organización
Intranet: un modelo para la transformación digital de la organización
 
Sap amazon and Kogent Demo
Sap amazon and Kogent DemoSap amazon and Kogent Demo
Sap amazon and Kogent Demo
 
PSBJ - Accelerating Sales Without a Marketing Budget
PSBJ - Accelerating Sales Without a Marketing BudgetPSBJ - Accelerating Sales Without a Marketing Budget
PSBJ - Accelerating Sales Without a Marketing Budget
 
mobileHut_May_16
mobileHut_May_16mobileHut_May_16
mobileHut_May_16
 
Salesforce1 data gov lunch anaheim deck
Salesforce1 data gov lunch anaheim deckSalesforce1 data gov lunch anaheim deck
Salesforce1 data gov lunch anaheim deck
 
Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”
Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”
Presentación webinar “Los 12 mejores trucos de velocidad para WordPress”
 
83 solid pancreatic masses on computed tomography
83 solid pancreatic masses on computed tomography83 solid pancreatic masses on computed tomography
83 solid pancreatic masses on computed tomography
 
Task Management: 11 Tips for Effective Management
Task Management: 11 Tips for Effective ManagementTask Management: 11 Tips for Effective Management
Task Management: 11 Tips for Effective Management
 
Estrategias
EstrategiasEstrategias
Estrategias
 
2015 South By Southwest Sports: #SXSports Insights
2015 South By Southwest Sports: #SXSports Insights2015 South By Southwest Sports: #SXSports Insights
2015 South By Southwest Sports: #SXSports Insights
 
美次級房貸風暴的影響評估
美次級房貸風暴的影響評估美次級房貸風暴的影響評估
美次級房貸風暴的影響評估
 
Zaragoza Turismo 20
Zaragoza Turismo 20Zaragoza Turismo 20
Zaragoza Turismo 20
 
EIT-Digital_Annual-Report-2015-Digital-Version
EIT-Digital_Annual-Report-2015-Digital-VersionEIT-Digital_Annual-Report-2015-Digital-Version
EIT-Digital_Annual-Report-2015-Digital-Version
 
Zaragoza Turismo 32
Zaragoza Turismo 32Zaragoza Turismo 32
Zaragoza Turismo 32
 

Similar a Ratpack and Grails 3

Microservice message routing on Kubernetes
Microservice message routing on KubernetesMicroservice message routing on Kubernetes
Microservice message routing on KubernetesFrans van Buul
 
The hardest part of microservices: your data
The hardest part of microservices: your dataThe hardest part of microservices: your data
The hardest part of microservices: your dataChristian Posta
 
Exploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservicesExploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservices💡 Tomasz Kogut
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnZalando Technology
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor FrameworkDamien Magoni
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Christian Posta
 
Mcknight well built extensions
Mcknight well built extensionsMcknight well built extensions
Mcknight well built extensionsRichard McKnight
 
Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice frameworkFabrice Sznajderman
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Storyvanphp
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"LogeekNightUkraine
 
BISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple SpacesBISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple SpacesSrinath Perera
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideMohanraj Thirumoorthy
 
SpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople
 
Managing your camels in the cloud with CI/CD
Managing your camels in the cloud with CI/CDManaging your camels in the cloud with CI/CD
Managing your camels in the cloud with CI/CDChristian Posta
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...OdessaJS Conf
 
Software Development: Beyond Training wheels
Software Development: Beyond Training wheelsSoftware Development: Beyond Training wheels
Software Development: Beyond Training wheelsNaveenkumar Muguda
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile appsIvano Malavolta
 

Similar a Ratpack and Grails 3 (20)

Microservice message routing on Kubernetes
Microservice message routing on KubernetesMicroservice message routing on Kubernetes
Microservice message routing on Kubernetes
 
The hardest part of microservices: your data
The hardest part of microservices: your dataThe hardest part of microservices: your data
The hardest part of microservices: your data
 
Exploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservicesExploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservices
 
AngularJS
AngularJSAngularJS
AngularJS
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor Framework
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
 
Mcknight well built extensions
Mcknight well built extensionsMcknight well built extensions
Mcknight well built extensions
 
Lagom : Reactive microservice framework
Lagom : Reactive microservice frameworkLagom : Reactive microservice framework
Lagom : Reactive microservice framework
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"
 
Jclouds Intro
Jclouds IntroJclouds Intro
Jclouds Intro
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
BISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple SpacesBISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple Spaces
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
 
SpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud Computing
 
Managing your camels in the cloud with CI/CD
Managing your camels in the cloud with CI/CDManaging your camels in the cloud with CI/CD
Managing your camels in the cloud with CI/CD
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...
 
Software Development: Beyond Training wheels
Software Development: Beyond Training wheelsSoftware Development: Beyond Training wheels
Software Development: Beyond Training wheels
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
 

Más de GR8Conf

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your TeamGR8Conf
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle GR8Conf
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerGR8Conf
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with GroovyGR8Conf
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with GebGR8Conf
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidGR8Conf
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the DocksGR8Conf
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean CodeGR8Conf
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsGR8Conf
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applicationsGR8Conf
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGR8Conf
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEBGR8Conf
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCGR8Conf
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshopGR8Conf
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spockGR8Conf
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedGR8Conf
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGR8Conf
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and GroovyGR8Conf
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineGR8Conf
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8confGR8Conf
 

Más de GR8Conf (20)

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Ratpack and Grails 3

  • 1. Lari Hotari @lhotari Pivotal Software, Inc. Ratpack and Grails 3
  • 2. Agenda • Grails 3 and Ratpack • Why async? • Modularity and micro service architectures
  • 3. • Embrace Gradle • Abstract packaging / deployment • Reach outside the servlet container • App profiles: Netty, Servlet, Batch, Hadoop • Lightweight deployments, support micro services Grails 3
  • 4.
  • 5. Why Netty / Ratpack? Why async?
  • 7. Programming model • Declarative programming expresses the logic of a computation without describing its control flow. • It's programming without the call stack, the programmer doesn't decide execution details. • Examples: functional and reactive programming, event / message based execution, distributed parallel computation algorithms like Map/Reduce
  • 8. 15 import ratpack.rx.RxRatpack 16 import ratpack.session.SessionModule 17 import ratpack.session.store.MapSessionsModule 18 import ratpack.session.store.SessionStorage 19 20 import static ratpack.groovy.Groovy.groovyTemplate 21 import static ratpack.groovy.Groovy.ratpack 22 import static ratpack.jackson.Jackson.json 23 import static ratpack.pac4j.internal.SessionConstants.USER_PROFILE 24 25 ratpack { 26 bindings { 27 bind DatabaseHealthCheck 28 add new CodaHaleMetricsModule().jvmMetrics().jmx().websocket(). 29 healthChecks() 30 add new HikariModule([URL: "jdbc:h2:mem:dev;INIT=CREATE SCHEMA IF NOT 31 EXISTS DEV"], "org.h2.jdbcx.JdbcDataSource") 32 add new SqlModule() 33 add new JacksonModule() 34 add new BookModule() 35 add new RemoteControlModule() 36 add new SessionModule() 37 add new MapSessionsModule(10, 5) 38 add new Pac4jModule<>(new FormClient("/login", new 39 SimpleTestUsernamePasswordAuthenticator()), new 40 AuthPathAuthorizer()) 41 42 init { BookService bookService -> 43 RxRatpack.initialize() 44 HystrixRatpack.initialize() 45 bookService.createTable() 46 } 47 } 48 49 handlers { BookService bookService -> 50 51 get { 52 bookService.all().toList().subscribe { List<Book> books -> 53 SessionStorage sessionStorage = request.get(SessionStorage) 54 UserProfile profile = sessionStorage.get(USER_PROFILE) 55 def username = profile?.getAttribute("username") 56 57 render groovyTemplate("listing.html", 58 username: username ?: "", 59 title: "Books", 60 books: books, 61 msg: request.queryParams.msg ?: "") 62 } 63 } 64 65 handler("create") { 66 byMethod { 67 get { 68 render groovyTemplate("create.html", title: "Create Book") 69 } 70 post { 71 Form form = parse(Form) 72 bookService.insert( 73 form.isbn, 74 form.get("quantity").asType(Long), 75 form.get("price").asType(BigDecimal) 76 ).single().subscribe { String isbn -> 77 redirect "/?msg=Book+$isbn+created" 78 } 79 } 80 } 81 } 82 83 handler("update/:isbn") { 84 def isbn = pathTokens["isbn"] 85 86 bookService.find(isbn).single().subscribe { Book book -> 87 if (book == null) { 88 clientError(404) 89 } else { 90 byMethod { 91 get { 92 render groovyTemplate("update.html", title: 93 "Update Book", book: book) 94 } 95 post { 96 Form form = parse(Form) 97 bookService.update( 98 isbn, 99 form.get("quantity").asType(Long), 100 form.get("price").asType(BigDecimal) 101 ) subscribe { 102 redirect "/?msg=Book+$isbn+updated" 103 } 104 } 105 } 106 } 107 } 108 } 109 110 post("delete/:isbn") { 111 def isbn = pathTokens["isbn"] 112 bookService.delete(isbn).subscribe { 113 redirect "/?msg=Book+$isbn+deleted" 114 } 115 } 116 117 prefix("api") { 118 get("books") { 119 bookService.all().toList().subscribe { List<Book> books -> 120 render json(books) 121 } 122 } 123 124 handler("book/:isbn?", registry.get(BookRestEndpoint)) 81 } 82 83 handler("update/:isbn") { 84 def isbn = pathTokens["isbn"] 85 86 bookService.find(isbn).single().subscribe { Book book -> 87 if (book == null) { 88 clientError(404) 89 } else { 90 byMethod { 91 get { 92 render groovyTemplate("update.html", title: 93 "Update Book", book: book) 94 } 95 post { 96 Form form = parse(Form) 97 bookService.update( 98 isbn, 99 form.get("quantity").asType(Long), 100 form.get("price").asType(BigDecimal) 101 ) subscribe { 102 redirect "/?msg=Book+$isbn+updated" 103 } 104 } 105 } 106 } 107 } 108 } 109 110 post("delete/:isbn") { 111 def isbn = pathTokens["isbn"] 112 bookService.delete(isbn).subscribe { 113 redirect "/?msg=Book+$isbn+deleted" source: https://github.com/ratpack/example-books/blob/master/src/ratpack/Ratpack.groovy Ratpack application consists of functional handler chains
  • 9. Ratpack applications • Ratpacks comes with Guice for dependency injection • Guice modules are also used as the plugin system for Ratpack • Examples of Ratpack module contributions: • Integrations to RxJava and Reactor. Can be used for async composition and preventing "callback hell". • Integration to Netflix Hystrix for adding error resilience functionality . f.e., Circuit-breaker pattern impl.
  • 10. Demo Ratpack and Grails (GORM) used together • https://github.com/lhotari/ratpack-gorm-example • Spring Boot embedded in Ratpack, running GORM
  • 11.
  • 12. Modularity • logical partitioning of the "software design" • allows complex software to be manageable for the purpose of implementation and maintenance
  • 13. Coupling and Cohesion • Coupling and cohesion are measures for describing how easy it will be to change the behaviour of some element in a system • Modules are coupled if a change in one forces a change in a the other • A module's cohesion is a measure of whether it's responsibilities form a meaningful unit source: GOOS book
  • 14. • Low coupling between modules ⟹ easier to change • High cohesion within module ⟹ single responsibility
  • 15. Microservice definition by James Lewis • Each application only does one thing • Small enough to fit in your head • Small enough that you can throw them away • Embedded web container • Packaged as a single executable jar • Use HTTP and HATEOAS to decouple services • Each app exposes metrics about itself
  • 16. –Arnon Rotem-Gal-Oz, Practical SOA “Nanoservice is an Anti-pattern where a service is too fine grained. Nanoservice is a service whose overhead (communications, maintenance etc.) out-weights its utility.”
  • 17. Polygot persistence • Common principle is that each service owns it's data - there is no shared database across multiple services. • If this principle is followed, it usually means switching to Hexagonal architecture, where persistence is an integration and not part of the core. • "Start with the events and behaviour instead of the database." • Data consistency models in distributed systems
  • 18. Brooks: "No silver bullet" • Essential complexity • complexity that you cannot escape • Accidental complexity • we could be adding complexity by bad design
  • 19. - Google's "Solve for X" “You don't spend your time being bothered that you can't teleport from here to Japan, because there's a part of you that thinks it's impossible. ! Moonshot thinking is choosing to be bothered by that.”
  • 20. Modular monoliths • Modular monoliths are composed of loosely coupled modules of single responsibility • Enabling the 3rd way (after monoliths and microservices) for building applications on the JVM across different libraries and frameworks • Modules can be turned into true micro services when needed - instead of introducing accidental complexity to projects that don't really require micro services in the beginning, but could benefit of them later
  • 21. The monoliths in the micro services architecture Single Page App in Browser API Gateway service µservice A SAAS Service A SAAS Service B µservice B µservice C µservice D µservice E µservice F
  • 22. "If you built it..."
  • 23.  pretotyping.org “Make sure you are building the right it before you build it right." ! "Fail fast ... and Often"
  • 24. Lari Hotari @lhotari Pivotal Software, Inc. Thank you!