Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gr8Conf: Implementing loosely coupled microservices with Grails

Gr8Conf: Implementing loosely coupled microservices with Grails

Grails 3 is s a great starting point for creating microservices and many projects are following this path. However many microservice landscapes are still based on synchronous calls to REST Resources which obviously increases coupling between those applications. This talk focusses on building loosely coupled microservices that are based on Domain Events, which are becoming more and more popular in the Domain Driven Design community. We will take a look at how Grails 3 helps us in building such systems by introducing the Grails 3 event system and by taking a look how we can leverage Domain Events for a decoupled communication between Grails applications.

Michael Plöd

June 01, 2017
Tweet

More Decks by Michael Plöd

Other Decks in Programming

Transcript

  1. Interactions between Microserivces Grails App A Grails App B Grails

    App C Grails Ap D Grails App E Grails App F
  2. Interactions between Microserivces Grails App A Grails App B Grails

    App C Grails Ap D Grails App E Grails App F ! " # $ %
  3. Challenges ! " # $ % Service Discovery Timeouts Errors

    Latency Load Balancing &Stability
  4. Usual Architecture Patterns > Event-Driven Architecture > REST > SOA

    > Microservices / Self-Contained Systems > CQRS > Reactive / Actor Model
  5. Domain Events > Applications can issue Domain Events > Domain

    Events are important occurrences in an Domain > UserVerified > ShoppingCartCheckedOut > ShipmentDelivered > Domain Events are usually based on eventual consistency > Major driver for high degree of decoupling between Microservices
  6. An event is something 
 that happened in the past

    t now Event Event Event Event Event
  7. NO

  8. NO

  9. NO

  10. Loan Details Entered Financial Situation Entered Personal Infromation Entered Application

    Submitted Use the 
 Grails 3 
 Event System for handling of internal Events Use 
 RabbitMQ 
 or 
 Kafka 
 for handling of external Events
  11. Options for Events Event with complete payload Event with a

    REST URL Empty Event as a Feed update notification > The Event contains all relevant data > Enables complete async processing > Payload is big and can fill up your message broker > The Event only contains a URL to a REST-Resource and some minimal data, that is usually always needed > Small payload that is fast to transport > Standard cases work completely asynchronous, more complex cases might require a synchronous roundtrip (without service lookup though) > The Event has no payload at all, it is just a notification > The payload, be it data or a REST URL, is usually contained in an Atom Feed > Event is a polling trigger for the feed
  12. THANK YOU I’ll post links to slides and code on

    Twitter
 Michael Plöd - innoQ @bitboss