Enterprise Integration Zone is brought to you in partnership with:

Nitin Kumar works as a Software Architect , predominately focus on Agile, TDD, Service Oriented Architecture, Grails and JEE. Besides working in software development, He writes technical articles and watch and study new technologies. He has been in IT for over 13 years and advocating on Craftsmanship, Domain driven development, TDD, Refactoring , Pair-Programming and lean development. He has expertise in high performance Java system and contributed to various open source projects. Nitin is a DZone MVB and is not an employee of DZone and has posted 13 posts at DZone. You can read more from them at their website. View Full User Profile

SOA and REST with Grails

08.12.2013
| 5785 views |
  • submit to reddit

In my previous articles I’ve introduced REST and how to leverage RESTful web services on the Grails platform. We will further discuss Grails in a service-oriented architecture using RESTful services, and we will try to visualize the architecture in detail.

SOA is a useful architectual pattern that makes highly interoperable applications.  According to Thomas Erl, “SOA is a term that represents a model in which automation logic is decomposed into smaller, distinct units of logic. Collectively, these units comprise a larger piece of business automation logic. Individually these units can be distributes.”

SOA and RESTfu1 are architectural considerations that exist independently from the specific technologies you use, like Java or SQL vs. NoSQL databases. It represents how data communicates between application components, and it determines the guidelines that need to be followed during data transfers between distributed systems.  This allows a high level of interoperability if the SOA is built properly.

RESTful web services in conjunction with SOAP can add REST’s simplicity, flexibility, and low overhead without compromising the power or manageability of service-oriented solutions and architectures.

Without debating whether REST or SOAP is better, I would like discuss how we harness both using the Grails application framework

The clickable diagram below depicts an example of SOA and REST using Grails:

Grails SOA REST

 

Components: A component is an encapsulated, independent part of the system’s build based on OO software principles. It will be accessed by the service layer using well-defined interfaces. Service components could be POJO-based Grails Domain, Grails plug-ins or plain Groovy or Java components.

Composites Services
: A composite service uses individually developed components and wires them together to create highly reusable, flexible and extensible business services that can be exposed and consumed by distributed systems. This is one level above the Components layer and can be made from Groovy, Java or Grails-defined services. Spring’s dependency injection pattern will be leveraged to access these components.

Service Resources
: This layer contains all the business services used by resource services in the form of GET, POST, PUT and DELETE. Service Resource Services are lightweight, stateless and independent services that communicate with a consumer via HTTP(S) protocols over various data formats such as XML, JSON, MIME, Byte etc. Service resources access business processes or composite services and expose them with HTTP(S) protocols.

Business Processes
: A business process is an abstract specification of business-aligned IT functions and used by resource services or a distributed system. Business processes orchestrate business composite services that perform well-defined business functions. These processes depend on the services layer to provide the building blocks for necessary functionality. Grails provides automated dependency injection through Spring core DI for Groovy, Java and Grails Services.

Integration (Enterprise Service Bus): The ESB layer provides a mechanism to expose the SOA’s services. The resource services are exposed using RESTful or SOAP-based web services and business processes. It may also provide message transformation, routing decisions, and protocol conversion capabilities.

Quality of Services: This layer provides services that enable infrastructure services for the solution and ease runtime environment management and monitoring.

Grails does an excellent job of helping developers use SOA and REST to deliver scalable, interoperable solutions in enterprise environments.

References:
•   http://www.soapatterns.org/
•   Service-Oriented Architecture (SOA): Concepts, Technology, and Design by Thomas Erl
•   http://www.ibm.com/developerworks/webservices/library/ws-soa-ref-arch/

Published at DZone with permission of Nitin Kumar, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Bob Brown replied on Mon, 2013/09/09 - 5:27am

Just note that Grails works fine with tools such as Spring Integration and Spring Batch, so one should not get the idea that everything requires a "roll your own approach."

Groovy's interop FTW!

I have written up some examples:

http://wordpress.transentia.com.au/wordpress/2010/01/25/solving-the-enterprise-integration-puzzle-with-spring-integration/

http://wordpress.transentia.com.au/wordpress/2010/02/03/batch-processing-with-spring-batch/

Both of these were published in GroovyMag: http://groovymag.com/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.