CUT YOUR GRAILS APPLICATION TO PIECES



Similar documents
Event-driven plugins with Grails 3. Göran Ehrsson, Technipelago AB

Engr. M. Fahad Khan Lecturer Software Engineering Department University Of Engineering & Technology Taxila

Intruduction to Groovy & Grails programming languages beyond Java

Apex Code: The World s First On-Demand Programming Language

Paul Boisvert. Director Product Management, Magento

Agile Development with Groovy and Grails. Christopher M. Judd. President/Consultant Judd Solutions, LLC

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

Rapid Application Development. and Application Generation Tools. Walter Knesel

Table of contents. Reverse-engineers a database to Grails domain classes.

SOA-14: Continuous Integration in SOA Projects Andreas Gies

Siebel Business Process Framework: Workflow Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

Grails 1.1. Web Application. Development. Reclaiming Productivity for Faster. Java Web Development. Jon Dickinson PUBLISHING J MUMBAI BIRMINGHAM

Database Migration Plugin - Reference Documentation

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

ActiveVOS Server Architecture. March 2009

METADATA-DRIVEN QLIKVIEW APPLICATIONS AND POWERFUL DATA INTEGRATION WITH QLIKVIEW EXPRESSOR

Essential Visual Studio Team System

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

How To Integrate With An Enterprise Service Bus (Esb)

Meister Going Beyond Maven

Enterprise Application Development In Java with AJAX and ORM

Dynamic website development using the Grails Platform. Joshua Davis Senior Architect Cognizant Technology Solutions

Customize Mobile Apps with MicroStrategy SDK: Custom Security, Plugins, and Extensions

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Configuring Integration Between Multichannel and Salesforce.com

Mobile Trillium Engine

Creating Web Services Applications with IntelliJ IDEA

How to Scale out SharePoint Server 2007 from a single server farm to a 3 server farm with Microsoft Network Load Balancing on the Web servers.

Automating Business Processes Using SharePoint Designer

SAP Exam C_TCRM20_72 SAP Certified Application Associate - CRM Fundamentals with SAP CRM 7.0 EhP2 Version: 6.0 [ Total Questions: 80 ]

Son of SOA Resource-Oriented Computing Event-Driven Architecture

SwiftScale: Technical Approach Document

GECKO Software. Introducing FACTORY SCHEMES. Adaptable software factory Patterns

Building native mobile apps for Digital Factory

Core J2EE Patterns, Frameworks and Micro Architectures

Intro to Embedded SQL Programming for ILE RPG Developers

Continuous Integration The Full Monty Artifactory and Gradle. Yoav Landman & Frederic Simon

Build management & Continuous integration. with Maven & Hudson

Portal Factory CMIS Connector Module documentation

Clustering a Grails Application for Scalability and Availability

The Service Revolution software engineering without programming languages

The Benefits of Utilizing a Repository Manager

SOFTWARE TESTING TRAINING COURSES CONTENTS

Oracle Service Bus Examples and Tutorials

70-487: Developing Windows Azure and Web Services

WELCOME TO Open Source Enterprise Architecture

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

FUSE-ESB4 An open-source OSGi based platform for EAI and SOA

SOA REFERENCE ARCHITECTURE: WEB TIER

Content. Development Tools 2(63)

A Tool for Evaluation and Optimization of Web Application Performance

Engine: Using MSBuild and Team Foundation

Software Development In the Cloud Cloud management and ALM

NUTECH COMPUTER TRAINING INSTITUTE 1682 E. GUDE DRIVE #102, ROCKVILLE, MD 20850

JSR-303 Bean Validation

Continuous Integration

Microsoft Windows PowerShell v2 For Administrators

Building a Reliable Messaging Infrastructure with Apache ActiveMQ

CRM 2013 Workflows. Description

Grails - Rapid Web Application Development for the Java Platform

ebay : How is it a hit

WORKING WITH LOAD BALANCING AND QUEUEING FOR ADOBE INDESIGN CS5 SERVER

STREAM ANALYTIX. Industry s only Multi-Engine Streaming Analytics Platform

PHP on IBM i: What s New with Zend Server 5 for IBM i

HPC Portal Development Platform with E-Business and HPC Portlets

Systems Integration in the Cloud Era with Apache Camel. Kai Wähner, Principal Consultant

Service Oriented Architectures

Administrative Guide VtigerCRM Microsoft Exchange Connector (Exchange Server 2010)

Load and Performance Load Testing. RadView Software October

ARCHITECTURAL DESIGN OF MODERN WEB APPLICATIONS

Oracle WebLogic Server 11g Administration

Monitoring Infrastructure (MIS) Software Architecture Document. Version 1.1

Apache CloudStack 4.x (incubating) Network Setup: excerpt from Installation Guide. Revised February 28, :32 pm Pacific

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Event-based middleware services

Open Source Telemedicine Android Client Development Introduction

CRM Magic with Data Migration & Integration

1. Introduction What is Slice? Background Why Slice? Purpose of this Document Intended Audience...

OptimalJ Foundation. PSM EJB Model. Roadmap. What is the EJB model? EJB model as a PSM model Mapping the EJB model Model elements and code generation

Sitecore InDesign Connector 1.1

django-cron Documentation

Introduction to WebSphere Administration

Core Java+ J2EE+Struts+Hibernate+Spring

CTC What's New?

Using SAML for Single Sign-On in the SOA Software Platform

ACE 2011 International

GPMD CheckoutSuite for Magento Documentation

Web Services API Developer Guide

QL Integration into Scala and Excel. Martin Dietrich

Drupal CMS for marketing sites

Case Study. Web Application for Financial & Economic Data Analysis Brainvire Infotech Pvt. Ltd Page 1 of 1

Cloud computing - Architecting in the cloud

Testing Tools Content (Manual with Selenium) Levels of Testing

5.1 Features Denver CO 80202

Social Enterprise Java Apps

Customer Bank Account Management System Technical Specification Document

COM 440 Distributed Systems Project List Summary

PHP Language Binding Guide For The Connection Cloud Web Services

Transcription:

CUT YOUR GRAILS APPLICATION TO PIECES BUILD FEATURE PLUGINS Göran Ehrsson Technipelago AB @goeh

Göran Ehrsson, @goeh From Stockholm, Sweden 25+ years as developer Founded Technipelago AB Grails enthusiast Author GR8 CRM plugins

Custom Business Applications Different industries Common requirements Customers Projects Tasks Documents Communication

The Challenge Customer have looked at off-the-shelf software but faced feature limitations or budget constraints Customer want something simple but it should be custom made for their specific business process Developing from scratch would be too expensive or feature limited There is a gap to fill between Excel and $100 000 CRM implementations Develop one app with VCS branches for each customer would end up in maintenance hell Copy code between similar projects is also a bad idea

Grails Plugins Plugins extend the platform. A plugin can: extend the data model add services provide static resources add command line scripts do a lot more The plugin framework provides lots of extension points

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 }

Installing local plugins grails maven-install repositories { mavenlocal() } plugins { compile :myplugin:0.1 } theapp/grails-app/conf/buildconfig.groovy 8

-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

Inline plugins Inline plugins lets you develop plugins as if the code were part of the application. Auto-reloading works so you immediately see changes. grails.project.dependency.resolution = { repositories { } plugins { //compile :myplugin:0.1 } } grails.plugin.location.myplugin =../../plugins/myplugin theapp/grails-app/conf/buildconfig.groovy

Plugin Design

Separation of Concern Each plugin should focus on one task or domain A plugin should be tested isolated from others Plugins make the boundaries strong and well defined Plugins force the developer to stay inside the box

Keep services and UI in separate plugins Put logic in the service layer, not in view controllers 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 rich client or micro service style applications

Avoid intra-plugin dependencies UI-plugins are allowed to talk directly to its 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

Communicate with messages/events Spring has built-in support for both synchronous 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 Grails 3 includes event support based on the Reactor framework

The application is the director Individual plugins should not know about other plugins The application is the director that coordinate events and route events from one plugin to another The application can access all plugins if needed

Drawbacks Problems you may face when going event driven: Error handling is harder Stacktraces Debugging events can be hard Not easy to follow code paths in IDE:s

What about the domain model? How can a plugin query and fetch data from another plugin if it can t have compile time dependencies? DetachedCriteria Selection plugin

DetachedCriteria Detached Criteria are criteria queries that are not associated with any given database session/connection. Detached Criteria queries allow you to create common reusable criteria queries, execute subqueries and execute batch updates/deletes, etc. def criteria = new DetachedCriteria(Person).build { eq 'lastname', 'Simpson' } def bartcriteria = criteria.build { eq 'firstname', 'Bart' } // No Hibernate session needed above this point def results = bartcriteria.list()

Selection plugin http://grails.org/plugin/selection Queries are expressed as URLs Queries are Serializable / can be saved in database or put on a message queue PersonService.groovy @Selectable PagedResultList<Person> list(map query, Map params) { Person.createCriteria().list(params) { } } def query = new URI( bean:personservice/list?name=a* ) def people = selectionservice.select(query, [max: 10])

More selection examples // GORM Criteria gorm://person/list?firstname=sven&lastname=anderson // Spring Bean bean://myservice/method/arg // External/Proxy Selection https://dialer.mycompany.com/outbound/next?agent=liza Security selection.gorm = true // No restrictions, use with care selection.gorm.com.mycompany.person = true // Person domain class only selection.gorm.com.mycompany = true // All domain classes in package com.mycompany

Soft Associations If a domain instance in a feature plugin need to associate itself with a domain instance in another plugin, use soft associations Stored as a String person@42 Instantiate when needed (put generic code in service) Find all Lookup the Spring domain bean named person Call person.get(42) Attachment.findAllBySoft( person@42 )

GR8 CRM gr8crm.github.io 40+ Grails plugins for rapid development of customer relationship management applications crm-contact & crm-contact-ui crm-content & crm-content-ui crm-task & crm-task-ui crm-campaign & crm-campaign-ui All GR8 CRM plugins are open source with the Apache 2.0 License crm-sales & crm-sales-ui crm-product & crm-product-ui crm-blog & crm-blog-ui

DEMO

Grails 3 Plugins Not backwards compatible Plugins must be updated Not as much work as expected migrate2-grails3 plugin helps Publish plugins to bintray

Grails 3 Events API Based on the Reactor Framework Grails services and controllers implement the Events trait on("myevent1") { println "Hello $it!" } on("myevent2") { return "Hello $it!" } notify "myevent1", "Greach" sendandreceive "myevent2", "Greach", { println "$it" }

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 event routing rules in the application (or in a separate plugin unique for each app)

References gr8crm.github.io github.com/goeh github.com/technipelago grails.org/plugin/ migrate2-grails3 @goeh goran@technipelago.se www.technipelago.se linkedin.com/in/gehrsson projectreactor.io