watch your communication - goto conference...the flipside of the coin • http was designed for a...

99

Upload: others

Post on 28-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication
Page 2: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Watch your communication How communication drives design

Uwe Friedrichsen (codecentric AG) – GOTO Berlin – Berlin, 13. November 2016

Page 3: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

@ufried Uwe Friedrichsen | [email protected] | http://slideshare.net/ufried | http://ufried.tumblr.com

Page 4: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

The “one-size-fits-all” trap

Page 5: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Standardization as a virtue

Page 6: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

We see that a lot •  One programming language

•  One framework

•  One build system

•  One type of runtime unit

•  One data store

•  One type of database access

•  One application server

•  One ...

•  One communication paradigm

Page 7: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Why are we doing it?

Page 8: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Reducing complexity •  Avoid intellectual overload •  Easier to understand

•  Easier to change

•  Faster to change

•  Easier to operate

•  Less error-prone

•  Cheaper

Page 9: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

These are valid and important reasons …

Page 10: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

... but that is just one side of the coin

Page 11: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

The complexity of a solution must match

the complexity of the problem to solve

Page 12: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

If your task is to build a box from pre-cut boards, only using a hammer might be adequate

Page 13: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

If your task is also to paint the box you just built, only having a hammer might be a problem …

Page 14: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Now imagine building a whole housejust with a hammer …

Page 15: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Yet, in IT we often tend to build whole houses just with a hammer

because boxes can be built with a hammer

Page 16: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Complexity mismatch means •  Increased accidental complexity •  Harder to understand

•  Harder to change

•  Slower to change

•  Harder to operate

•  More error-prone

•  More expensive

Page 17: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Complexity

Essential complexity

Adds direct accidental complexity

Problem complexity

Ideal solution

complexity

Adds indirect accidental complexity

Page 18: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Complexity

Problem complexity

Overly complex solution

Increased accidental complexity

More “tooling” than needed to get the job done well

Page 19: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Complexity

Problem complexity

Over- simplified solution

Increased accidental complexity

Not enough “tooling” to get the job done well

Page 20: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Overall Solution Complexity := Essential Problem Complexity + Solution Complexity Mismatch

Solution Complexity Mismatch a.k.a. Accidental Complexity

Be aware that mismatch in both directions adds to overall solution complexity

Page 21: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Complexity

Essential complexity

Problem complexity

Aim for the least complex solution with respect to the problem you have to solve

(Yes, it is about trade-offs – as always in architecture)

Page 22: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Communication paradigms

Page 23: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Communication paradigms

•  Dimensions of communication

•  Synchronous vs. asynchronous

•  Request/response vs. message passing

•  Commands, Events and Documents

•  Sender/Receiver dependency

Page 24: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Communication paradigms •  Typical communication patterns

•  Synchronous request/response

•  Asynchronous commands (with known receiver)

•  Asynchronous events (without known receiver)

Page 25: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

The “synchronous request/response everywhere” trap

Page 26: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Why are we doing it?

Page 27: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Remember the “one-size-fits-all” trap?

Page 28: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Yes, but why this paradigm?

Page 29: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Why synchronous R/R?

•  “It’s how the internet works”

•  “The library support is better”

•  “It is easier to reason about”

•  Matches the way we consciously think

•  Matches the way we learned to do design

Page 30: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Do not forget the other side of the coin

Page 31: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

The flipside of the coin •  HTTP was designed for a specific use case

•  Access hypermedia content

•  Not an ubiquitous communication solution

•  The world outside a process is different •  Non-determinism kills easy reasoning

•  Latency creep kills easy reasoning

•  Solution mismatch adds complexity •  Compromises functional encapsulation

•  Changes and extensions become more complicated

•  Longer activation paths compromise robustness

Page 32: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Designing communication

Page 33: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

An (invidious) example …

Page 34: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment

Page 35: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Let us begin with the well-known synchronous request/response design ...

Page 36: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Initial version with limited functionality •  Order includes

•  Items •  Amounts •  Price per item •  Total price

•  Credit card payment

•  Only non-digital items

Page 37: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Credit Card

Coordinate

Warehouse

Page 38: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add coupons •  Order additionally includes

•  Optional coupon ID •  Optional remaining coupon value •  Coupon is already charged against total price

•  Validate coupon

Page 39: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Coupon Credit Card

Coordinate

Warehouse

Coordinate

Credit Card Provider

Page 40: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add promotions •  Order additionally includes

•  Optional promotion ID •  Promotion is already applied to order

•  Notify Campaign Management System about promotion usage

Page 41: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Coupon Campaign

Management Promotion

Credit Card

Coordinate

Warehouse

Coordinate

Credit Card Provider

Page 42: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add customer accounts •  Order additionally includes

•  Payment type (Credit card/Account)

•  Charge customer account

Page 43: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Campaign Management

Account service

Accounts Receivables

Coordinate

Warehouse

Credit Card Provider

Coupon

Promotion

Credit Card

Coordinate

Page 44: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add PayPal •  Order additionally includes

•  More payment types (Credit card/PayPal/Account)

•  Payment via PayPal

Page 45: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Promotion Campaign

Management

Account service

Payment provider

PayPal

Accounts Receivables

Coupon

Credit Card

Coordinate

Warehouse

PayPal

Coordinate

Page 46: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add digital music library •  New shipment method

•  Activate music assets in digital music library •  Notify customer via email including access link

•  Digital music library has its own API

Page 47: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Promotion Campaign

Management

Account service

Payment provider

PayPal

Accounts Receivables

Music Library

E-Mail Server

Coupon

Credit Card

Coordinate

Warehouse

Coordinate

Music

Notify Cust.

PayPal

Coordinate

Page 48: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add digital video library •  New digital shipment channel

•  Activate video assets in digital video library •  Notify customer via email including access link

•  Digital video library has its own API •  Different from the music library API

Page 49: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Promotion Campaign

Management

Account service

Payment provider

PayPal

Accounts Receivables

Music Library Video Library

E-Mail Server

Coupon

Credit Card

Coordinate

Warehouse

Coordinate

Assets

Notify Cust.

PayPal

Coordinate

Page 50: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add e-book library •  New digital shipment channel

•  Activate e-books in e-book library •  Notify customer via email including access link

•  E-Book library has its own API •  Different from the other asset library APIs

Page 51: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Promotion Campaign

Management

Account service

Payment provider

PayPal

Accounts Receivables

Music Library

E-Book Library

Video Library

E-Mail Server

Coupon

Credit Card

Coordinate

Warehouse

Coordinate

Assets

Notify Cust.

PayPal

Coordinate

Page 52: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add bonus card •  Order additionally includes

•  Optional bonus card ID •  Potential discount is already applied to order

•  Notify Loyalty Management System about customer purchase

Page 53: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Promotion Campaign

Management Loyalty

Account service

Payment provider

PayPal

Loyalty Management

Accounts Receivables

Music Library

E-Book Library

Video Library

E-Mail Server

Coupon

Credit Card

Coordinate

Warehouse

Coordinate

Assets

Notify Cust.

PayPal

Coordinate

Page 54: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment

More requirements to come …

Page 55: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order Fulfillment Service

Online Shop

Payment Service

Credit Card Provider

Shipment Service

Warehouse System

<Foreign Service> <Own Service>

Coupon Management

Promotion Campaign

Management Loyalty

Account service

Payment provider

PayPal

Loyalty Management

Accounts Receivables

Music Library

E-Book Library

Video Library

E-Mail Server

Coupon

Credit Card

Coordinate

Warehouse

Coordinate

Assets

Notify Cust.

PayPal

Coordinate

Synchronous request/response – findings “Divide and conquer” design •  Tight service coupling

•  including cross-domain coupling

•  Long activation paths

•  Latency creep •  Availability erosion

•  Underlying design assumption is 100% availability of all services used

•  Complex orchestration logic in services •  including cross-service transactions

•  New downstream services require changes of upstream services •  including knowledge about how to access downstream services in upstream services

Page 56: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Let us repeat the design using asynchronous events ...

Page 57: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment

Page 58: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Initial version with limited functionality •  Order includes

•  Items •  Amounts •  Price per item •  Total price

•  Credit card payment

•  Only non-digital items

Page 59: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Credit Card Service

Warehouse Service

Payment authorized

<Event>

Payment failed

Page 60: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add coupons •  Order additionally includes

•  Optional coupon ID •  Optional remaining coupon value •  Coupon is already charged against total price

•  Validate coupon

Page 61: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Credit Card Service

Warehouse Service

Payment authorized

<Event>

Payment failed

Coupon Management

Coupon Service

Page 62: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add promotions •  Order additionally includes

•  Optional promotion ID •  Promotion is already applied to order

•  Notify Campaign Management System about promotion usage

Page 63: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Credit Card Service

Warehouse Service

Promotion Service

Coupon Service

Payment authorized

<Event>

Payment failed

Page 64: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add customer accounts •  Order additionally includes

•  Payment type (Credit card/Account)

•  Charge customer account

Page 65: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Accounts Receivables

Warehouse Service

Promotion Service

Coupon Service

Payment authorized

Payment failed

<Event>

Page 66: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add PayPal •  Order additionally includes

•  More payment types (Credit card/PayPal/Account)

•  Payment via PayPal

Page 67: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Accounts Receivables

PayPal

PayPal Service

Warehouse Service

Promotion Service

Coupon Service

Payment authorized

Payment failed

<Event>

Page 68: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add digital music library •  New shipment method

•  Activate music assets in digital music library •  Notify customer via email including access link

•  Digital music library has its own API

Page 69: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Accounts Receivables

Music Library

E-Mail Server

PayPal

PayPal Service

Warehouse Service

Promotion Service

Coupon Service

Music Library Service

Notification Service

Payment authorized Digital asset provisioned

Payment failed

<Event>

Page 70: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add digital video library •  New digital shipment channel

•  Activate video assets in digital video library •  Notify customer via email including access link

•  Digital video library has its own API •  Different from the music library API

Page 71: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Accounts Receivables

Music Library

Video Library E-Mail Server

PayPal

PayPal Service

Warehouse Service

Promotion Service

Coupon Service

Music Library Service

Video Library Service

Notification Service

Payment authorized Digital asset provisioned

Payment failed

<Event>

Page 72: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add e-book library •  New digital shipment channel

•  Activate e-books in e-book library •  Notify customer via email including access link

•  E-Book library has its own API •  Different from the other asset library APIs

Page 73: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Accounts Receivables

Music Library

E-Book Library

Video Library E-Mail Server

PayPal

PayPal Service

Warehouse Service

Promotion Service

Coupon Service

Music Library Service

Video Library Service

E-Book Library Service

Notification Service

Payment authorized Digital asset provisioned

Payment failed

<Event>

Page 74: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order fulfillment Add bonus card •  Order additionally includes

•  Optional bonus card ID •  Promotion is already applied to order

•  Notify Loyalty Management System about customer purchase

Page 75: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Loyalty Management

Accounts Receivables

Music Library

E-Book Library

Video Library E-Mail Server

PayPal

PayPal Service

Warehouse Service

Promotion Service

Bonus Card Service

Coupon Service

Music Library Service

Video Library Service

E-Book Library Service

Notification Service

Payment authorized Digital asset provisioned

Payment failed

<Event>

Page 76: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

And how do we figure out if a business transaction eventually completes?

Page 77: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Loyalty Management

Accounts Receivables

Music Library

E-Book Library

Video Library E-Mail Server

PayPal

PayPal Service

Warehouse Service

Promotion Service

Bonus Card Service

Coupon Service

Music Library Service

Video Library Service

E-Book Library Service

Notification Service

Order fulfillment supervisor

Payment authorized Digital asset provisioned

Payment failed

<Event>

Track flow of events. Reschedule events in case of failure

Services are responsible to eventually succeed or fail for good, usually incorporating a supervision/escalation hierarchy for that

Page 78: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Order confirmed

Online Shop

Credit Card Provider

Warehouse System

<Foreign Service>

<Own Service>

Coupon Management

Campaign Management

Account service

Credit Card Service

Loyalty Management

Accounts Receivables

Music Library

E-Book Library

Video Library E-Mail Server

PayPal

PayPal Service

Warehouse Service

Promotion Service

Bonus Card Service

Coupon Service

Music Library Service

Video Library Service

E-Book Library Service

Notification Service

Payment authorized Digital asset provisioned

Payment failed

<Event>

Order fulfillment supervisor

Track flow of events Reschedule events in case of failure

Services are responsible to eventually succeed or fail for good, usually incorporating a supervision/escalation hierarchy for that Asynchronous events – findings “Go with the flow” design •  Services and domains decoupled •  Very short activation paths

•  High responsiveness •  High availability

•  No design assumptions about availability of services

•  Coordination via choreography •  No central coordination and cross-service transactions •  Instead functional compensation logic in external supervision service

•  New services can be integrated without touching existing services •  Services only focus on their task (no knowledge about other services required)

Page 79: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Didn’t we miss any special cases thatwould lead to very different findings?

Page 80: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Some special cases

Synchronous request/response design •  Current order status

•  E.g., pass status through call chain •  Maybe additionally extend order fulfillment service

to store status in an status information database

•  Payment failed •  E.g., stop processing in fulfillment service and send

back appropriate status to online shop

•  Cashing coupon failed •  E.g., extend payment service to place task in desk

officer ’s inbox

•  Integrate new video library (different API) •  Adapt shipment service to new API •  Make sure not to disrupt other service aspects

Page 81: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Some special cases

Asynchronous events design •  Current order status

•  E.g., track events with a new service and storethem in an status information database

•  Payment failed •  E.g., track dedicated event with a new service

that notifies customer and/or online shop

•  Cashing coupon failed •  E.g., send out dedicated event that a new service

subscribes to •  New service then places task in desk officer ’s inbox

•  Integrate new video library (different API) •  Implement new service •  Replace existing service with new service

Page 82: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Feels a lot like recurring patterns …

Page 83: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

What did we learn so far?

Page 84: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Comparing the paradigms … •  Decomposition

•  Vertically divide-and-conquer vs. horizontally go-with-the-flow

•  Coordination •  Coordination logic/services and orchestration vs. event chains and choreography

•  Transactions •  Built-in transaction handling vs. external supervision

•  Error handling •  Built into service vs. escalation/supervision strategy

•  Separation of concerns •  Multiple responsibilities service vs. single responsibility services

•  Encapsulation •  Domain logic distributed across services vs. domain logic in one place

•  Complexity •  A draw …

Page 85: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Different communication paradigms lead to very different service designs

… which means different options to address a given problem

Page 86: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Related areas and limitations

Page 87: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Mixing communication paradigms

Page 88: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Mixing paradigms •  Always an option •  Note the trade-off between design purity

and solution mismatch complexity •  A (very) simple heuristic

•  Single functionality •  All-or-nothing characteristic •  Single domain

Ø  Synchronous request/response

•  Multiple functionalities •  Flow/Process characteristic •  Multiple domains

Ø  Asynchronous messaging

Page 89: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

What if the paradigm is fixed?

Page 90: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Fixed paradigm

•  You can simulate other paradigms

•  E.g., simulate sync. r/r with async. messaging •  E.g., simulate async. commands with sync. r/r

•  Will support the service design topic •  Apart from that it is a (lame) compromise

Page 91: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

What about user interaction?

Page 92: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

User interaction

•  Interaction with user client is usually r/r

•  Use web sockets if available

•  Use the mediator pattern with timeouts •  Could be implemented via a BFF service

•  Complement with processing status page

Page 93: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Can we apply the same patterns inside process boundaries?

Page 94: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Inside process boundaries •  Have the process context in mind

•  Without threads •  If your downstream call dies, you are also dead •  Usually synchronous r/r is appropriate •  Otherwise single-threaded scheduler is needed

•  With threads •  “Multi-process light” •  Better multi-threading resilience possible •  More design options

Page 95: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

Wrap-up

•  The one-size-fits-all trap

•  Communication paradigms

•  The synchronous-r/r-everywhere trap

•  Designing communication

•  Influence on service design

Different communication paradigms lead to very different service designs

Page 96: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

There is no “one-size-fits-all” solution

Page 97: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication

@ufried Uwe Friedrichsen | [email protected] | http://slideshare.net/ufried | http://ufried.tumblr.com

Page 98: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication
Page 99: Watch your communication - GOTO Conference...The flipside of the coin • HTTP was designed for a specific use case • Access hypermedia content • Not an ubiquitous communication