Slides from my talk at QCon London on March 3rd 2020. Abstract: Integrating microservices or other components is hard, as it involves taming distributed systems. New API technologies are great, but can't magically solve all underlying challenges. This talk distills real-life experiences around typical architecture patterns. You will understand why you have to carefully think about boundaries and responsibilities of all your components. Further you will see why balancing orchestration and choreography is essential to avoid chaos. We also need to talk about idempotency, long-running and event-driven services. Don’t worry if you are new here, I will use easy to understand examples. In the end you will have gained a better feeling how to make your API smarter.
15. We are having some technical
difficulties and cannot present you
your boarding pass right away.
But we do actively retry ourselves, so
lean back, relax and we will send it
on time.
29. 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
39. Example
Booking Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
40. Example
Booking Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
A few
smart god services
tell
anemic CRUD services
what to do
Sam Newmann
41. Payment
failed
Who is responsible to deal with problems?
Booking Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
46. Synchronous communication
is the crystal meth of
distributed programming
Todd Montgomery and Martin Thompson
in “How did we end up here” at GOTO Chicago 2015
68. Example:
order fulfillment via
dash button
Photo by 0xF2, available under Creative Commons BY-ND 2.0
license. https://www.flickr.com/photos/0xf2/29873149904/
@berndruecker
74. The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
75. The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
76. The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
82. Order
It is not about the protocol!
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
It can still be messaging!
@berndruecker
83. Order
It is about where to decide about the coupling!
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
Order decides
. to listen to the event
. to issue the command
@berndruecker
89. . Distributed systems are complex. At-least-once, retries and
idempotency are here to stay. Embrace async!
. Long-running services make your life easier and your API
smarter.
. Change business processes and customer experience accordingly
. Use commands + events = balance choreography and
orchestration