Cut your Grails application to pieces - build feature plugins

GR8Conf
GR8ConfGR8Conf
1
Göran Ehrsson
Technipelago AB
Cut your Grails App to Pieces
Build Feature Plugins
2
Technipelago AB
3
Custom Business Applications
Different industries
Common requirements
• Customers
• Communication (email)
• Documents
• Tasks
• …
4
The challenge
Customer want something simple but it should
rocket fuel their business process
Customer have looked at standard software but
found show stoppers or budget constraints
Developing from scratch each time would be too
expensive or feature limited
One app with VCS branches for each customer
would end up in maintenance hell
Copy code between projects is extremly bad
5
Say no to copy & paste!
⌘-C
⌘-V
⌘-C
⌘-V
6
Grails Plugins
Plugins extend the platform.

A plugin can:
extend the data model
add services
provide static resources
add command line scripts
…
The Grails platform provides

lots of extension points
7
Create a plugin
grails create-plugin myplugin
!
cd myplugin
grails run-app
A Grails plugin is a regular Grails project with
a plugin descriptor in the root of the project.
class MypluginGrailsPlugin {
def version = ”0.1”
}
8
Installing local plugins
grails maven-install
repositories {
…
mavenLocal()
}
!
plugins {
compile ”:myplugin:0.1”
}
theapp/grails-app/conf/BuildConfig.groovy
8
9
-SNAPSHOT versions
Prior to Grails 2.3 local plugins with -SNAPSHOT
versions was not supported due to ivy limitation
Workarounds:
Increment version number before each release
Delete ivy-cache efter each release
Use a remote repository manager (Artifactory)
Grails 2.3+ uses Aether as dependency resolver and
local -SNAPSHOT versions are supported
10
Publish plugins to your own
Repository Manager
You can use a remote repository manager, like
Archiva, Artifactory or Nexus. Host it yourself or
use an external pay-per-use cloud service.
grails.project.repos.mycompany.url =

"http://repo.mycompany.com/plugins-releases/"
grails.project.repos.mycompany.username = "admin"
grails.project.repos.mycompany.password = "password"
~/.grails/settings.groovy
grails publish-plugin --repository=mycompany
11
Configure

remote repositories
repositories {
…
mavenRepo ”http://repo.mycompany.com/plugins-snapshots/”
}
!
plugins {
compile ”:myplugin:1.0-SNAPSHOT”
}
theapp/grails-app/conf/BuildConfig.groovy
12
Inline plugins
grails.project.dependency.resolution = {
repositories {
…
}
plugins {
//compile ”:myplugin:0.1”
}
}
grails.plugin.location.myplugin = ”../../plugins/myplugin”
theapp/grails-app/conf/BuildConfig.groovy
Inline plugins lets you develop plugins as if the
code were part of the application. Auto-reloading
works so you immediately see changes.
13
Plugin Design
Separation of concern
Keep services and related UI
in separate plugins
Avoid intra-plugin
dependencies
Communicate with events
The application is the director
14
Separation of Concern
Each plugin should focus on one task or domain
A plugin should be tested isolated from others
Boundaries are strong and well defined
It forces the developer to stay inside the box
15
Keep services and UI in separate
plugins
Most of the logic are located in the service layer
You may want to have different user interface
plugins for different requirements
The same service plugin can be used in both the
web-front application and in back-office without
exposing admin UI to web-front
You can use the same service plugin in different
micro service style applications
16
Avoid intra-plugin dependencies
UI-plugins are allowed to talk directly to it’s
associated service plugin, but not the opposite
Place common features in one

or few common plugins.
Other plugins are allowed

to depend on common plugins
17
Communicate with events
Spring has built-in support for both synchronous
(default) and asynchronous events
Spring Integration includes advanced event support
Apache Camel supports Event Message pattern (EIP)
Grails platform-core plugin includes great event
handling
Synchronous, Asynchronous, Event Reply
The Grails events plugin is a evolution of platform-
core events
18
Application is the director
Individual plugins should not know about other
plugins
The Application route events from one plugin to
another
The Application can access all plugins if needed
The Application is the director that coordinate
events
19
Drawbacks
Debugging events can be hard
How to deal with exceptions
Not easy to follow code paths in IDE
20
DEMO
21
Real software…
22
Real Plugins - Demo Application
23
Real Plugins - Demo Application
24
GR8CRM
crm-contact & crm-contact-lite
crm-content & crm-content-ui
crm-task & crm-task-ui
crm-campaign & crm-campaign-ui
crm-product & crm-product-ui
crm-blog & crm-blog-ui
crm-ui-bootstrap
~40 plugins in total
25
Dynamic Associations
If a domain class in a feature plugin need to
associate with a domain instance in another
plugin, use ”dynamic associations”
”crmContact@42”
The framework will lookup the domain instance
when needed
Lookup Spring bean ”crmContact”
Call crmContact.get(42)
26
Summary
Focus on domain model (not persistent entities)
Decouple business logic from user interface
Publish events asynchronously

(synchronously if you must)
Let the application be just a container for plugins
Put customer unique code and message routing
rules in the application

(or in a separate plugin unique for each app)
27
References
http://gr8crm.github.io
https://github.com/goeh
https://github.com/technipelago
(all plugins open sourced under the Apache 2.0 License)
@goeh
goran@technipelago.se
http://www.technipelago.se
https://www.linkedin.com/in/gehrsson
1 of 27

Recommended

Performance tuning Grails applications by
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applicationsGR8Conf
774 views19 slides
Performance tuning Grails applications by
Performance tuning Grails applicationsPerformance tuning Grails applications
Performance tuning Grails applicationsLari Hotari
3.9K views19 slides
GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook by
GR8Conf 2011: Tuning Grails Applications by Peter LedbrookGR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
GR8Conf 2011: Tuning Grails Applications by Peter LedbrookGR8Conf
3.2K views25 slides
Performance tuning Grails applications SpringOne 2GX 2014 by
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Lari Hotari
3.7K views49 slides
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com by
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.comAdvanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.comDevOpsDays Tel Aviv
3.6K views58 slides
Operating a High Velocity Large Organization with Spring Cloud Microservices by
Operating a High Velocity Large Organization with Spring Cloud MicroservicesOperating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesNoriaki Tatsumi
547 views53 slides

More Related Content

What's hot

Simulating Different-Network Speeds using JMETER by
Simulating Different-Network Speeds using JMETERSimulating Different-Network Speeds using JMETER
Simulating Different-Network Speeds using JMETERAgile Testing Alliance
3.5K views5 slides
#speakgeek - Pragmatic Batch Process Management & Developer Testing by
#speakgeek - Pragmatic Batch Process Management & Developer Testing#speakgeek - Pragmatic Batch Process Management & Developer Testing
#speakgeek - Pragmatic Batch Process Management & Developer TestingDerek Chan
758 views42 slides
Andreas Grabner - Performance as Code, Let's Make It a Standard by
Andreas Grabner - Performance as Code, Let's Make It a StandardAndreas Grabner - Performance as Code, Let's Make It a Standard
Andreas Grabner - Performance as Code, Let's Make It a StandardNeotys_Partner
394 views27 slides
JIRA Performance Testing in Pictures - Edward Bukoski Michael March by
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchJIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchAtlassian
10.3K views35 slides
Patterns of a "Good" Test Automation Framework, Locators & Data by
Patterns of a "Good" Test Automation Framework, Locators & DataPatterns of a "Good" Test Automation Framework, Locators & Data
Patterns of a "Good" Test Automation Framework, Locators & DataAgile Testing Alliance
3.6K views43 slides
A Prophet in Production Shiri Hochhauser by
A Prophet in Production   Shiri HochhauserA Prophet in Production   Shiri Hochhauser
A Prophet in Production Shiri HochhauserDevOpsDays Tel Aviv
72 views29 slides

What's hot(20)

#speakgeek - Pragmatic Batch Process Management & Developer Testing by Derek Chan
#speakgeek - Pragmatic Batch Process Management & Developer Testing#speakgeek - Pragmatic Batch Process Management & Developer Testing
#speakgeek - Pragmatic Batch Process Management & Developer Testing
Derek Chan758 views
Andreas Grabner - Performance as Code, Let's Make It a Standard by Neotys_Partner
Andreas Grabner - Performance as Code, Let's Make It a StandardAndreas Grabner - Performance as Code, Let's Make It a Standard
Andreas Grabner - Performance as Code, Let's Make It a Standard
Neotys_Partner394 views
JIRA Performance Testing in Pictures - Edward Bukoski Michael March by Atlassian
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchJIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
Atlassian10.3K views
Patterns of a "Good" Test Automation Framework, Locators & Data by Agile Testing Alliance
Patterns of a "Good" Test Automation Framework, Locators & DataPatterns of a "Good" Test Automation Framework, Locators & Data
Patterns of a "Good" Test Automation Framework, Locators & Data
Code review automation and functional tests on Carrefour by Denis Santos
Code review automation and functional tests on CarrefourCode review automation and functional tests on Carrefour
Code review automation and functional tests on Carrefour
Denis Santos299 views
Performance test on Carrefour by Denis Santos
Performance test on CarrefourPerformance test on Carrefour
Performance test on Carrefour
Denis Santos325 views
Continuous integration practices to improve the software quality by Fabricio Epaminondas
Continuous integration practices to improve the software qualityContinuous integration practices to improve the software quality
Continuous integration practices to improve the software quality
Parallel run selenium tests in a good way by COMAQA.BY
Parallel run selenium tests in a good  wayParallel run selenium tests in a good  way
Parallel run selenium tests in a good way
COMAQA.BY 1.5K views
ATAGTR2017 Batch Workload Modelling and Performance Optimization by Agile Testing Alliance
ATAGTR2017 Batch Workload Modelling and Performance Optimization ATAGTR2017 Batch Workload Modelling and Performance Optimization
ATAGTR2017 Batch Workload Modelling and Performance Optimization
Using Processes and Timers for Long-Running Asynchronous Tasks by OutSystems
Using Processes and Timers for Long-Running Asynchronous TasksUsing Processes and Timers for Long-Running Asynchronous Tasks
Using Processes and Timers for Long-Running Asynchronous Tasks
OutSystems372 views
QA Team Goes to Agile and Continuous integration by Sujit Ghosh
QA Team Goes to Agile and Continuous integrationQA Team Goes to Agile and Continuous integration
QA Team Goes to Agile and Continuous integration
Sujit Ghosh142 views
PAC 2019 virtual Philip Webb by Neotys
PAC 2019 virtual Philip Webb PAC 2019 virtual Philip Webb
PAC 2019 virtual Philip Webb
Neotys198 views
The Agile Process - Taming Your Process To Work For You by Nowell Strite
The Agile Process - Taming Your Process To Work For YouThe Agile Process - Taming Your Process To Work For You
The Agile Process - Taming Your Process To Work For You
Nowell Strite1.5K views
Industry Keynote at Large Scale Testing Workshop 2015 by Wolfgang Gottesheim
Industry Keynote at Large Scale Testing Workshop 2015Industry Keynote at Large Scale Testing Workshop 2015
Industry Keynote at Large Scale Testing Workshop 2015
Wolfgang Gottesheim1.9K views
Solving micro-services and one site problem by aragavan
Solving micro-services and one site problemSolving micro-services and one site problem
Solving micro-services and one site problem
aragavan185 views

Similar to Cut your Grails application to pieces - build feature plugins

Scaling frontend applications with micro-frontends Presentation.pdf by
Scaling frontend applications with micro-frontends Presentation.pdfScaling frontend applications with micro-frontends Presentation.pdf
Scaling frontend applications with micro-frontends Presentation.pdfKatamaRajuBandigari1
11 views37 slides
不只自動化而且更敏捷的Android開發工具 gradle by
不只自動化而且更敏捷的Android開發工具 gradle不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradlesam chiu
12.2K views50 slides
Exploring the GitHub Service Universe by
Exploring the GitHub Service UniverseExploring the GitHub Service Universe
Exploring the GitHub Service UniverseBjörn Kimminich
9.5K views133 slides
Google Cloud Platform by
Google Cloud Platform Google Cloud Platform
Google Cloud Platform Francesco Marchitelli
23.2K views71 slides
Cloud-native Java EE-volution by
Cloud-native Java EE-volutionCloud-native Java EE-volution
Cloud-native Java EE-volutionQAware GmbH
466 views43 slides
CIP Developing Curator Tool Wizards by
CIP Developing Curator Tool WizardsCIP Developing Curator Tool Wizards
CIP Developing Curator Tool WizardsEdwin Rojas
174 views26 slides

Similar to Cut your Grails application to pieces - build feature plugins(20)

Scaling frontend applications with micro-frontends Presentation.pdf by KatamaRajuBandigari1
Scaling frontend applications with micro-frontends Presentation.pdfScaling frontend applications with micro-frontends Presentation.pdf
Scaling frontend applications with micro-frontends Presentation.pdf
不只自動化而且更敏捷的Android開發工具 gradle by sam chiu
不只自動化而且更敏捷的Android開發工具 gradle不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradle
sam chiu12.2K views
Exploring the GitHub Service Universe by Björn Kimminich
Exploring the GitHub Service UniverseExploring the GitHub Service Universe
Exploring the GitHub Service Universe
Björn Kimminich9.5K views
Cloud-native Java EE-volution by QAware GmbH
Cloud-native Java EE-volutionCloud-native Java EE-volution
Cloud-native Java EE-volution
QAware GmbH466 views
CIP Developing Curator Tool Wizards by Edwin Rojas
CIP Developing Curator Tool WizardsCIP Developing Curator Tool Wizards
CIP Developing Curator Tool Wizards
Edwin Rojas174 views
Use AppDynamics SDK to Integrate with your Applications - AppSphere16 by AppDynamics
Use AppDynamics SDK to Integrate with your Applications - AppSphere16Use AppDynamics SDK to Integrate with your Applications - AppSphere16
Use AppDynamics SDK to Integrate with your Applications - AppSphere16
AppDynamics1.3K views
Cloud-native Patterns by VMware Tanzu
Cloud-native PatternsCloud-native Patterns
Cloud-native Patterns
VMware Tanzu681 views
Cloud-native Patterns (July 4th, 2019) by Alexandre Roman
Cloud-native Patterns (July 4th, 2019)Cloud-native Patterns (July 4th, 2019)
Cloud-native Patterns (July 4th, 2019)
Alexandre Roman191 views
Why we don’t use the Term DevOps: the Journey to a Product Mindset - DevOpsCo... by Henning Jacobs
Why we don’t use the Term DevOps: the Journey to a Product Mindset - DevOpsCo...Why we don’t use the Term DevOps: the Journey to a Product Mindset - DevOpsCo...
Why we don’t use the Term DevOps: the Journey to a Product Mindset - DevOpsCo...
Henning Jacobs1.4K views
Why we don’t use the Term DevOps: the Journey to a Product Mindset - Destinat... by Henning Jacobs
Why we don’t use the Term DevOps: the Journey to a Product Mindset - Destinat...Why we don’t use the Term DevOps: the Journey to a Product Mindset - Destinat...
Why we don’t use the Term DevOps: the Journey to a Product Mindset - Destinat...
Henning Jacobs535 views
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021) by Igalia
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
Igalia194 views
James Turner (Caplin) - Enterprise HTML5 Patterns by akqaanoraks
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patterns
akqaanoraks868 views
Developer Nirvana with IBM Bluemix™ by IBM
Developer Nirvana with IBM Bluemix™Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™
IBM805 views
Magic with groovy & grails by George Platon
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grails
George Platon581 views
Alfresco Development Framework Basic by Mario Romano
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
Mario Romano1.2K views
Mobile backends with Google Cloud Platform (MBLTDev'14) by Natalia Efimtseva
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)
Natalia Efimtseva515 views

More from GR8Conf

DevOps Enabling Your Team by
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your TeamGR8Conf
396 views69 slides
Creating and testing REST contracts with Accurest Gradle by
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
891 views112 slides
Mum, I want to be a Groovy full-stack developer by
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
543 views59 slides
Metaprogramming with Groovy by
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with GroovyGR8Conf
728 views99 slides
Scraping with Geb by
Scraping with GebScraping with Geb
Scraping with GebGR8Conf
827 views68 slides
How to create a conference android app with Groovy and Android by
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
521 views87 slides

More from GR8Conf(20)

DevOps Enabling Your Team by GR8Conf
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
GR8Conf396 views
Creating and testing REST contracts with Accurest Gradle by GR8Conf
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
GR8Conf891 views
Mum, I want to be a Groovy full-stack developer by GR8Conf
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
GR8Conf543 views
Metaprogramming with Groovy by GR8Conf
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
GR8Conf728 views
Scraping with Geb by GR8Conf
Scraping with GebScraping with Geb
Scraping with Geb
GR8Conf827 views
How to create a conference android app with Groovy and Android by GR8Conf
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
GR8Conf521 views
Ratpack On the Docks by GR8Conf
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
GR8Conf998 views
Groovy Powered Clean Code by GR8Conf
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
GR8Conf1.3K views
Ratpack and Grails 3 by GR8Conf
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
GR8Conf1.7K views
Grails & DevOps: continuous integration and delivery in the cloud by GR8Conf
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
GR8Conf3.2K views
Functional testing your Grails app with GEB by GR8Conf
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
GR8Conf3.7K views
Deploying, Scaling, and Running Grails on AWS and VPC by GR8Conf
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
GR8Conf2.3K views
The Grails introduction workshop by GR8Conf
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
GR8Conf774 views
Idiomatic spock by GR8Conf
Idiomatic spockIdiomatic spock
Idiomatic spock
GR8Conf2.4K views
The Groovy Ecosystem Revisited by GR8Conf
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
GR8Conf580 views
Groovy 3 and the new Groovy Meta Object Protocol in examples by GR8Conf
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
GR8Conf4.5K views
Integration using Apache Camel and Groovy by GR8Conf
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
GR8Conf976 views
CRaSH the shell for the Java Virtual Machine by GR8Conf
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
GR8Conf931 views
Grooscript gr8conf by GR8Conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
GR8Conf696 views
CRaSH the shell for the Java Virtual Machine by GR8Conf
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
GR8Conf1.7K views

Recently uploaded

Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
111 views13 slides
PharoJS - Zürich Smalltalk Group Meetup November 2023 by
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023Noury Bouraqadi
141 views17 slides
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...Jasper Oosterveld
28 views49 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
40 views43 slides
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...ShapeBlue
63 views13 slides
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...ShapeBlue
83 views15 slides

Recently uploaded(20)

Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue111 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi141 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman40 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue63 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue83 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue46 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue48 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue85 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue65 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson133 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue96 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue96 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue88 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray1080 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue50 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue74 views

Cut your Grails application to pieces - build feature plugins

  • 1. 1 Göran Ehrsson Technipelago AB Cut your Grails App to Pieces Build Feature Plugins
  • 3. 3 Custom Business Applications Different industries Common requirements • Customers • Communication (email) • Documents • Tasks • …
  • 4. 4 The challenge Customer want something simple but it should rocket fuel their business process Customer have looked at standard software but found show stoppers or budget constraints Developing from scratch each time would be too expensive or feature limited One app with VCS branches for each customer would end up in maintenance hell Copy code between projects is extremly bad
  • 5. 5 Say no to copy & paste! ⌘-C ⌘-V ⌘-C ⌘-V
  • 6. 6 Grails Plugins Plugins extend the platform.
 A plugin can: extend the data model add services provide static resources add command line scripts … The Grails platform provides
 lots of extension points
  • 7. 7 Create a plugin grails create-plugin myplugin ! cd myplugin grails run-app A Grails plugin is a regular Grails project with a plugin descriptor in the root of the project. class MypluginGrailsPlugin { def version = ”0.1” }
  • 8. 8 Installing local plugins grails maven-install repositories { … mavenLocal() } ! plugins { compile ”:myplugin:0.1” } theapp/grails-app/conf/BuildConfig.groovy 8
  • 9. 9 -SNAPSHOT versions Prior to Grails 2.3 local plugins with -SNAPSHOT versions was not supported due to ivy limitation Workarounds: Increment version number before each release Delete ivy-cache efter each release Use a remote repository manager (Artifactory) Grails 2.3+ uses Aether as dependency resolver and local -SNAPSHOT versions are supported
  • 10. 10 Publish plugins to your own Repository Manager You can use a remote repository manager, like Archiva, Artifactory or Nexus. Host it yourself or use an external pay-per-use cloud service. grails.project.repos.mycompany.url =
 "http://repo.mycompany.com/plugins-releases/" grails.project.repos.mycompany.username = "admin" grails.project.repos.mycompany.password = "password" ~/.grails/settings.groovy grails publish-plugin --repository=mycompany
  • 11. 11 Configure
 remote repositories repositories { … mavenRepo ”http://repo.mycompany.com/plugins-snapshots/” } ! plugins { compile ”:myplugin:1.0-SNAPSHOT” } theapp/grails-app/conf/BuildConfig.groovy
  • 12. 12 Inline plugins grails.project.dependency.resolution = { repositories { … } plugins { //compile ”:myplugin:0.1” } } grails.plugin.location.myplugin = ”../../plugins/myplugin” theapp/grails-app/conf/BuildConfig.groovy Inline plugins lets you develop plugins as if the code were part of the application. Auto-reloading works so you immediately see changes.
  • 13. 13 Plugin Design Separation of concern Keep services and related UI in separate plugins Avoid intra-plugin dependencies Communicate with events The application is the director
  • 14. 14 Separation of Concern Each plugin should focus on one task or domain A plugin should be tested isolated from others Boundaries are strong and well defined It forces the developer to stay inside the box
  • 15. 15 Keep services and UI in separate plugins Most of the logic are located in the service layer You may want to have different user interface plugins for different requirements The same service plugin can be used in both the web-front application and in back-office without exposing admin UI to web-front You can use the same service plugin in different micro service style applications
  • 16. 16 Avoid intra-plugin dependencies UI-plugins are allowed to talk directly to it’s associated service plugin, but not the opposite Place common features in one
 or few common plugins. Other plugins are allowed
 to depend on common plugins
  • 17. 17 Communicate with events Spring has built-in support for both synchronous (default) and asynchronous events Spring Integration includes advanced event support Apache Camel supports Event Message pattern (EIP) Grails platform-core plugin includes great event handling Synchronous, Asynchronous, Event Reply The Grails events plugin is a evolution of platform- core events
  • 18. 18 Application is the director Individual plugins should not know about other plugins The Application route events from one plugin to another The Application can access all plugins if needed The Application is the director that coordinate events
  • 19. 19 Drawbacks Debugging events can be hard How to deal with exceptions Not easy to follow code paths in IDE
  • 22. 22 Real Plugins - Demo Application
  • 23. 23 Real Plugins - Demo Application
  • 24. 24 GR8CRM crm-contact & crm-contact-lite crm-content & crm-content-ui crm-task & crm-task-ui crm-campaign & crm-campaign-ui crm-product & crm-product-ui crm-blog & crm-blog-ui crm-ui-bootstrap ~40 plugins in total
  • 25. 25 Dynamic Associations If a domain class in a feature plugin need to associate with a domain instance in another plugin, use ”dynamic associations” ”crmContact@42” The framework will lookup the domain instance when needed Lookup Spring bean ”crmContact” Call crmContact.get(42)
  • 26. 26 Summary Focus on domain model (not persistent entities) Decouple business logic from user interface Publish events asynchronously
 (synchronously if you must) Let the application be just a container for plugins Put customer unique code and message routing rules in the application
 (or in a separate plugin unique for each app)
  • 27. 27 References http://gr8crm.github.io https://github.com/goeh https://github.com/technipelago (all plugins open sourced under the Apache 2.0 License) @goeh goran@technipelago.se http://www.technipelago.se https://www.linkedin.com/in/gehrsson