Slide 1

Slide 1 text

Loosely Coupled Microservices with Grails Michael Plöd @bitboss

Slide 2

Slide 2 text

Interactions between Microserivces Grails App A Grails App B Typically RESTful HTTP

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

Interactions between Microserivces Grails App A Grails App B Grails App C Grails Ap D Grails App E Grails App F ! " # $ %

Slide 5

Slide 5 text

Welcome to the Dark Side

Slide 6

Slide 6 text

Challenges ! " # $ % Service Discovery Timeouts Errors Latency Load Balancing &Stability

Slide 7

Slide 7 text

Usual Architecture Patterns > Event-Driven Architecture > REST > SOA > Microservices / Self-Contained Systems > CQRS > Reactive / Actor Model

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Domain Events Customer
 Notification
 Application Shipping
 Application Shipment
 Delivered
 Event Messaging
 System Shipment
 Delivered
 Event

Slide 10

Slide 10 text

An event is something 
 that happened in the past t now Event Event Event Event Event

Slide 11

Slide 11 text

ShipmentDeliveredEvent
 CustomerVerifiedEvent CartCheckedOutEvent CreateCustomerEvent
 WillSaveItemEvent
 DoStuffEvent

Slide 12

Slide 12 text

An Event is always immutable !

Slide 13

Slide 13 text

Loan Details Entered Financial Situation Entered Personal Infromation Entered Application Submitted Credit
 Application Scoring … …

Slide 14

Slide 14 text

Let’s reuse the ESB from the failed SOA project

Slide 15

Slide 15 text

NO

Slide 16

Slide 16 text

NO

Slide 17

Slide 17 text

NO

Slide 18

Slide 18 text

Talking about Grails

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

https://github.com/mploed/event-driven-spring-boot Let’s replace the Scoring one with a Grails 3 Microservice! https://github.com/mploed/event-driven-grails

Slide 22

Slide 22 text

THANK YOU I’ll post links to slides and code on Twitter
 Michael Plöd - innoQ @bitboss