SlideShare a Scribd company logo
Moving beyond request-reply:
How smart APIs are different.
@berndruecker
Moving beyond request reply - designing smarter APIs
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Failure will happen.
Accept it!
But keep it local!
Be resilient.
Photo by Tookapic, available under Creative Commons CC0 1.0 license.
„There was an error
while sending your
boarding pass“
Check-in
Web-UI
Me
Current situation
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the good part
Circuit
breaker
Moving beyond request reply - designing smarter APIs
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the bad part
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the bad part
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the bad part
Stateful
Retry
Moving beyond request reply - designing smarter APIs
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.
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Possible situation – much better!
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Possible situation – much better!
Stateful
Retry
Warning:
Contains Opinion
Berlin, Germany
http://berndruecker.io/
mail@berndruecker.io
@berndruecker
Bernd Ruecker
Co-founder and
Chief Technologist of
Camunda
Check-In
You can use a workflow engine (=durable state machine)!
Barcode
REST
Stateful
retry
Want to see code?
https://github.com/berndruecker/flowing-retail
has to implement
Retry
has to implement
Idempotency
Client Service Provider
Moving beyond request reply - designing smarter APIs
Moving beyond request reply - designing smarter APIs
Don‘t worry, it will happen safely –
even if you loose connection.
Feel free to reload this page any time!
Photo by pixabay, available under Creative Commons CC0 1.0 license.
Requirement: Idempotency of services!
Photo by pixabay, available under Creative Commons CC0 1.0 license.
Requirement: Idempotency of services!
Photo by Chr.Späth, available under Public Domain.
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
Distributed systems introduce complexity you have to tackle!
Credit
Card
Payment
REST
Distributed
systems
It is impossible to
differentiate certain
failure scenarios.
Independant of
communication style!
Service
Provider
Client
Distributed systems introduce complexity you have to tackle!
Credit
Card
Payment
REST
Distributed systems introduce complexity you have to tackle!
Credit
Card
Payment
REST
Cancel
charge
Being able to implement
long running services
is essential for smart APIs
(on a technical level)
@berndruecker
Example
Booking Payment
Retrieve
Payment
@berndruecker
Example
Booking Payment
Credit
Card
Retrieve
Payment
@berndruecker
Example
Booking Payment
Credit
Card
Retrieve
Payment
Rejected
@berndruecker
Example
Booking Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
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
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
Payment
failed
Long running services
Booking Payment
Credit
Card
Retrieve
Payment
Rejected
Payment
received
Smart endpoints are
potentially long-running
@berndruecker
Being able to implement
long running services
is essential for smart APIs
(on a business level)
@berndruecker
Long running services
require async communication
Synchronous communication
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
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Asynchronous communication
You need to
monitor
timeouts
Workflow…
Workflow…
Being able to implement
long running services
makes it easy to get async
@berndruecker
Can your company
leverage your
hipster architecture?
Shutterstock
You need to
change business
processes and
customer
experience!
Example
@berndruecker
Example
Payment
Seat
ReservationBooking
Ticket
Generation
Example
@berndruecker
sync
Example
@berndruecker
Weaknesses
Payment
Seat
ReservationBooking
Ticket
Generation
REST
Weaknesses: Latency creep
Payment
Seat
ReservationBooking
Ticket
Generation
REST
300 ms
1150 + x ms
600 ms
250 ms
Weaknesses: Availabiliy erosion
Payment
Seat
ReservationBooking
Ticket
Generation
REST
99 % uptime
99 % uptime
99 % uptime
96 % uptime
And it is even hard to implement
Payment
Seat
ReservationBooking
Ticket
Generation
REST
And it is even hard to implement
Payment
Seat
ReservationBooking
Ticket
Generation
REST
Typical pattern
Payment
Seat
ReservationBooking
Ticket
Generation
REST
Simulate synchronicty by waiting
(callback or polling)
@berndruecker
happy
case
failure
case
Redesign your business process accordingly!
Or some interface
to poll for status
Sync in happy case
Async response
@berndruecker
Redesign your business process accordingly!
Your business processes need to be more reactive!
@berndruecker
https://www.reactivemanifesto.org/
Yeah!
Let‘s go reactive.
Phil Calcado at QCon NYC 2019
API
API
API
API
API
API
API
Microservices
External Services
Standard Software
„What the hell just happened?“
@berndruecker
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
Three steps…
@berndruecker
(Micro-)services
Checkout
Payment
Inventory
Shipment
@berndruecker
Order
Placed
Payment
Received
Goods
Fetched
Notification
Checkout
Payment
Inventory
Shipment
Event-driven architecture
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
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
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
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
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
Fetch the goods
before the
payment
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Fetch the goods
before the
payment
Goods
fetched
Order
placed
Payment
received
Goods
shipped
@berndruecker
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and P..19 / CC BY-SA 4.0
@berndruecker
Order
Extract the end-to-end responsibility
Checkout
Payment
Inventory
ShipmentPayment
received
Order
placed
Retrieve
payment
@berndruecker
Order
Events & Commands
Checkout
Payment
Inventory
ShipmentPayment
received
Order
placed
Retrieve
payment
@berndruecker
Event
Command
Fact,
happened in the past,
immutable
Intend,
Want s.th. to happen
Order
It is not about the protocol!
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
It can still be messaging!
@berndruecker
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
Extract Orchestration logic
Workflows live inside service boundaries
@berndruecker
Your ITarchitecture
Choreography
Orchestration
@berndruecker
Your services
or applications
Monolith Chaos
Choreography
Orchestration
@berndruecker
Process Monitoring
Your services
or applications
Your ITarchitecture
Process Monitoring
Monolith Chaos
Choreography
Orchestration
Your services
or applications
Balance choreography and orchestration
@berndruecker
. 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
Thank you!
mail@berndruecker.io
@berndruecker
https://berndruecker.io
https://medium.com/berndruecker
https://github.com/berndruecker
https://www.infoq.com/articles/events-
workflow-automation
Contact:
Slides:
Blog:
Code:
https://www.infoworld.com/article/3254777/
application-development/
3-common-pitfalls-of-microservices-
integrationand-how-to-avoid-them.html
https://thenewstack.io/5-workflow-automation-
use-cases-you-might-not-have-considered/

More Related Content

PDF
Kafka Summit 2020: If an event is published to a topic and no one is around t...
PDF
Complex event flows in distributed systems (QCon London 2019)
PDF
Reactive Summit 2020 - How state helps you to stay reactive
PDF
Monitoring and Orchestration of your Microservices Landscape with Kafka and Z...
PDF
Complex event flows in distributed systems
PDF
GOTOpia 2020 - Balancing Choreography and Orchestration
PDF
2019 - Lost in transaction
PDF
Serverless Days 2019 - Lost in transaction
Kafka Summit 2020: If an event is published to a topic and no one is around t...
Complex event flows in distributed systems (QCon London 2019)
Reactive Summit 2020 - How state helps you to stay reactive
Monitoring and Orchestration of your Microservices Landscape with Kafka and Z...
Complex event flows in distributed systems
GOTOpia 2020 - Balancing Choreography and Orchestration
2019 - Lost in transaction
Serverless Days 2019 - Lost in transaction

What's hot (20)

PDF
Apache Kafka Meets Workflow Engines | Bernd Ruecker, Camunda
PDF
JCon 2021 - Loosely or lousily coupled
PDF
Camunda Con 2019 Keynote - I want my process back #microservices #serverless
PDF
Automating Processes in Modern Architectures
PDF
Monitoring and Orchestration of your Microservices Landscape with Kafka and Z...
PDF
QCon NYC 2019 - Workflow automation reinvented
PDF
Digitalization and Workflow Automation - Camunda Process Automation Forum
PDF
Process Automation Forum April 2021 - Practical Process Automation
PDF
Lost in transaction - Strategies to deal with (in)consistency in distributed ...
PDF
AWS Community Summit London 2019 - Lost in transaction
PDF
Destination Automation: Automating Processes in Modern Hipster Architectures
PDF
Workflow automation with BPMN. Lessons learned.
PDF
Jfokus 2018: Lost in transaction - Strategies to deal with (in-)consistency ...
PDF
JAX 2019 - Workflow automation reinvented
PDF
Microservices with Camunda - Talk from Camunda Days 01/2018
PDF
Webinar: Monitoring & Orchestrating Your Microservices Landscape using Workfl...
PDF
DDD Europe 2019: Lost in transaction
PDF
OOP 2021 - Leverage the full potential of your hipster architecture
PDF
JFS 2021 - The Process Automation Map
PDF
Java User Group Erfurt 2018: Zeebe.io - Event-driven Microservice Orchestration
Apache Kafka Meets Workflow Engines | Bernd Ruecker, Camunda
JCon 2021 - Loosely or lousily coupled
Camunda Con 2019 Keynote - I want my process back #microservices #serverless
Automating Processes in Modern Architectures
Monitoring and Orchestration of your Microservices Landscape with Kafka and Z...
QCon NYC 2019 - Workflow automation reinvented
Digitalization and Workflow Automation - Camunda Process Automation Forum
Process Automation Forum April 2021 - Practical Process Automation
Lost in transaction - Strategies to deal with (in)consistency in distributed ...
AWS Community Summit London 2019 - Lost in transaction
Destination Automation: Automating Processes in Modern Hipster Architectures
Workflow automation with BPMN. Lessons learned.
Jfokus 2018: Lost in transaction - Strategies to deal with (in-)consistency ...
JAX 2019 - Workflow automation reinvented
Microservices with Camunda - Talk from Camunda Days 01/2018
Webinar: Monitoring & Orchestrating Your Microservices Landscape using Workfl...
DDD Europe 2019: Lost in transaction
OOP 2021 - Leverage the full potential of your hipster architecture
JFS 2021 - The Process Automation Map
Java User Group Erfurt 2018: Zeebe.io - Event-driven Microservice Orchestration
Ad

Similar to Moving beyond request reply - designing smarter APIs (20)

PDF
Camunda Con Live 2020 Keynote - Microservice Orchestration and Integration
PDF
JCon Live 2023 - Lice coding some integration problems
PDF
WeAreDevelopers Live 2024 - Mastering long-running processes in modern archit...
PDF
Communication between (micro-)services - Bernd Rücker - Codemotion Amsterdam ...
PDF
Camunda Day New York 2019: Workflow Automation in Microservices Architectures...
PDF
O'Reilly SA NYC 2018: Complex event flows in distributed systems
PPT
3 d secure password
PPT
3D secure password
PDF
QCon London: Mastering long-running processes in modern architectures
PDF
Long running processes in DDD
PDF
Get Paid presentation_20190123
PDF
Impulse statement: Insights in the FinTech evolution
PDF
Get Paid! Plugins, Gateways, BitCoin: WordPress Ecommerce Project Management
PDF
Complex Event Flows in Distributed Systems (Bernd Ruecker, Camunda) Kafka Sum...
PDF
Goto meetup Stockholm - Let your microservices flow
PDF
CamundaCon 2020 Keynote - The Return of Process Automation
PDF
Apidays Paris 2023 - Kafka in Event-Driven Architectures, Hassane Moustapha, ...
PDF
Loosely or lousily coupled - Understanding communication patterns in microser...
PPSX
Ccavenue presentation
PDF
E AUTHENICATION SYSTEM USING QR CODE AND OTP
Camunda Con Live 2020 Keynote - Microservice Orchestration and Integration
JCon Live 2023 - Lice coding some integration problems
WeAreDevelopers Live 2024 - Mastering long-running processes in modern archit...
Communication between (micro-)services - Bernd Rücker - Codemotion Amsterdam ...
Camunda Day New York 2019: Workflow Automation in Microservices Architectures...
O'Reilly SA NYC 2018: Complex event flows in distributed systems
3 d secure password
3D secure password
QCon London: Mastering long-running processes in modern architectures
Long running processes in DDD
Get Paid presentation_20190123
Impulse statement: Insights in the FinTech evolution
Get Paid! Plugins, Gateways, BitCoin: WordPress Ecommerce Project Management
Complex Event Flows in Distributed Systems (Bernd Ruecker, Camunda) Kafka Sum...
Goto meetup Stockholm - Let your microservices flow
CamundaCon 2020 Keynote - The Return of Process Automation
Apidays Paris 2023 - Kafka in Event-Driven Architectures, Hassane Moustapha, ...
Loosely or lousily coupled - Understanding communication patterns in microser...
Ccavenue presentation
E AUTHENICATION SYSTEM USING QR CODE AND OTP
Ad

More from Bernd Ruecker (14)

PDF
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
PDF
JFall - Process Oriented Integration
PDF
CamundaCon NYC 2023 Keynote - Shifting into overdrive with process orchestration
PDF
JavaLand 2023 - Process Oriented Integration
PDF
CraftConf: Surviving the hyperautomation low code bubbl
PDF
Mastering Data for Higher Business Impact - at Commerzbank Innovation Summit
PDF
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
PDF
CamundaCon 2022 Keynote: The Process Orchestration Journey
PDF
JAX 2022 - Loosely or lousily coupled
PDF
CamundaCon 2021 Keynote :From Human Workflow to High-Throughput Process Autom...
PDF
Kafka Summit 2021 - Apache Kafka meets workflow engines
PDF
Micronaut Webinar 2021 - Process Automation Introduction
PDF
Webinar "Communication Between Loosely Coupled Microservices"
PDF
Camunda Meetup: Rethink Business Processes and User Experience to Leverage Th...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
JFall - Process Oriented Integration
CamundaCon NYC 2023 Keynote - Shifting into overdrive with process orchestration
JavaLand 2023 - Process Oriented Integration
CraftConf: Surviving the hyperautomation low code bubbl
Mastering Data for Higher Business Impact - at Commerzbank Innovation Summit
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
CamundaCon 2022 Keynote: The Process Orchestration Journey
JAX 2022 - Loosely or lousily coupled
CamundaCon 2021 Keynote :From Human Workflow to High-Throughput Process Autom...
Kafka Summit 2021 - Apache Kafka meets workflow engines
Micronaut Webinar 2021 - Process Automation Introduction
Webinar "Communication Between Loosely Coupled Microservices"
Camunda Meetup: Rethink Business Processes and User Experience to Leverage Th...

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Understanding_Digital_Forensics_Presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Review of recent advances in non-invasive hemoglobin estimation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing

Moving beyond request reply - designing smarter APIs