Slides from the Camunda webinar "Communication Between Loosely Coupled Microservices" in February 2021. Recording can be found online: https://page.camunda.com/wb-communication-between-microservices
7. Microservices Webinar Series
What When
Communication Between Microservices Today
Benefits of Long-Running Microservices Q2/2021
Business Transactions And Consistency Q3/2021
Accelerate Via Cloud-Native Q4/2021
9. How does ordering Pizza works?
Pizza
Place
You
Phone Call
Synchronous blocking communication
Feedback loop (ack, confirmation or rejection)
Temporal coupling (e.g. busy, not answering)
Pizza
Place
You
Email
Asynchronous non-blocking communication
No temporal coupling
Pizza
Place
You
A feedback loop might make sense
(ack, confirmation or rejection)
Email
Confirmation Email
10. Feedback loop != result
Pizza
Place
You
Email
Confirmation Email
Pizza Delivery
Feedback (ACK, confirmation, rejection)
Result
15. Only the first communication step is synchronous
Pizza
Place
You
PUT/order
HTTP 200
Pizza Delivery
The task of
Pizza making is
long running
16. Only the first communication step is synchronous
Pizza
Place
You
PUT/order
HTTP 200
Pizza Delivery
The task of
Pizza making is
long running
17. Command vs. event-based communication
Pizza
Place
You
I order this pizza
OK – got it
Command = Intent
Cannot be ignored
Independant of communication channel
Pizza
Place
You
„Hey – I am hungry!“
Event = Fact
Sender can't control what happens
18. Events vs. Commands
„Pizza Salmon
is ready!“
I baked this for my friend Andrea.
Please package it immediately and
deliver it over while it‘s hot!
19. Definitions
Event = Something happened in the past. It is a fact.
Sender does not know who picks up the event.
Command = Sender wants s.th. to happen. It has an intent.
Recipient does not know who issued the command.
27. Order
Fulfillment
Collaboration style is independant of communication style
Checkout
Payment
Inventory
Shipment
Payment
received
Order
placed
Retrieve
payment
@berndruecker
Choreography
Orchestration
Asynchronous
non-blocking
Asynchronous
non-blocking
Synchronous
blocking
28. Want to learn more about choreography vs. orchestration?
https://learning.oreilly.com/library/view/practical-process-automation/9781492061441/
30 days trial: https://learning.oreilly.com/get-learning/?code=PPAER20
Recording from QCon: https://drive.google.com/file/d/1IRWoQCX-gTPs7RVP5VrXaF1JozYWVbJv/view?usp=sharing
Slides: https://www.slideshare.net/BerndRuecker/gotopia-2020-balancing-choreography-and-orchestration
29. Communication Options – Quick Summary
Communication
Style
Synchronous
Blocking
Asynchronous
Non-Blocking
Collaboration
Style
Command-Driven Event-Driven
Example REST
Messaging
(Queues)
Messaging
(Topics)
Feedback Loop
HTTP
Response
Response
Message
-
Pizza Ordering via Phone Call E-Mail Twitter
This is not the
same!
31. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
32. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
33. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Temporal Coupling Service depends on
availability of other
services
Synchronous blocking
communication
Reduce or manage
34. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Temporal Coupling Service depends on
availability of other
services
Synchronous blocking
communication
Reduce or manage
35. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Temporal Coupling Service depends on
availability of other
services
Synchronous blocking
communication
Reduce or manage
Deployment Coupling Multiple services can only
be deployed together
Release train Typically avoid, but
depends
36. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Temporal Coupling Service depends on
availability of other
services
Synchronous blocking
communication
Reduce or manage
Deployment Coupling Multiple services can only
be deployed together
Release train Typically avoid, but
depends
37. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Temporal Coupling Service depends on
availability of other
services
Synchronous blocking
communication
Reduce or manage
Deployment Coupling Multiple services can only
be deployed together
Release train Typically avoid, but
depends
Domain Coupling Business capabilities
require multiple services
Order fulfillment requires
payment, inventory and
shipping
Unavoidable unless you
change business
requirements or service
boundaries
38. Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Temporal Coupling Service depends on
availability of other
services
Synchronous blocking
communication
Reduce or manage
Deployment Coupling Multiple services can only
be deployed together
Release train Typically avoid, but
depends
Domain Coupling Business capabilities
require multiple services
Order fulfillment requires
payment, inventory and
shipping
Unavoidable unless you
change business
requirements or service
boundaries
This is influenced with the communication
or collaboration style
40. Patterns To Survive Remote Communication
Service
Consumer
Pattern/Concept Use With
Service
Provider
X Service Discovery Sync (X)
X Circuit Breaker Sync
X Bulkhead Sync
(X) Load Balancing Sync X
X Retry Sync / Async
X Idempotency Sync / Async X
De-duplication Async X
(X) Back Pressure & Rate Limiting Sync / (Async) X
X Await feedback Async
X Sagas Sync / Async (X) …
41. Patterns To Survive Remote Communication
Service
Consumer
Pattern/Concept Use With
Service
Provider
X Service Discovery Sync (X)
X Circuit Breaker Sync
X Bulkhead Sync
(X) Load Balancing Sync X
X Retry Sync / Async
X Idempotency Sync / Async X
De-duplication Async X
(X) Back Pressure & Rate Limiting Sync / (Async) X
X Await feedback Async
X Sagas Sync / Async (X) …
53. Make every service idempotent!
Credit
Card
Payment
Charge Credit Card
cardNumber
amount
Charge Credit Card
cardNumber
amount
transactionId
Not idempotent
Idempotent
charge
Generally: create Ids
as soon as possible
58. Patterns To Survive Remote Communication
Service
Consumer
Pattern/Concept
Service
Provider
X Service Discovery (X)
X Circuit Breaker
Bulkhead
(X) Load Balancing X
X Retry
X Idempotency X
De-duplication X
(X) Back Pressure & Rate Limiting X
X Await feedback
X Sagas (X)
59. Patterns For Remote Communication
Service
Consumer
Pattern/Concept
Service
Provider
X Service Discovery (X)
X Circuit Breaker
Bulkhead
(X) Load Balancing X
X Retry
X Idempotency X
De-duplication X
(X) Back Pressure & Rate Limiting X
X Await feedback
X Sagas (X)
62. Take Away
• Know
• communication styles (sync/async)
• collaboration styles (command/event)
• Patterns to survive
• You can get rid of temporal coupling with asynchronous communication
• Make sure you or your team can handle it
• You will need long running capabilities (you might need it anyway)
• Domain coupling does not go away!
63. Want to know more?
https://page.camunda.com/wp-ultimate-
guide-to-process-automation-and-
microservices