How
Process Orchestration
Increases Agility
Without Harming
Architecture
@berndruecker
Choreography is great!
Photo by Lijian Zhang, under Creative Commons SA 2.0 License
What we wanted
Photo by Lijian Zhang, under Creative Commons SA 2.0 License and Wikimedia Commons / CC BY-SA 4.0
@berndruecker
Order
Placed
Payment
Received
Goods
Fetched
Notification
Event-driven
@berndruecker
Checkout
Payment
Inventory
Shipment
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
Phil Calcado at QCon NYC 2019
Notification
Checkout
Payment
Inventory
Shipment
@berndruecker
Pinball Machine Architecture
„What the hell just happened?“
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
Why is it so tempting?
Service
A
Event Bus
A
B
Service
B
C
Service
C
D
E
F
Service
D
G
Service
…
Service
…
Service …
Service
…
Service …
Service …
Service
…
@berndruecker
Why is it so tempting?
Service
A
Event Bus
A
B
Service
B
C
Service
C
D
E
F
Service
D
G
Service
…
Service
…
Service …
Service
…
Service …
Service …
Service
…
Adding is easy!
You can „buy“ a shorter
initial time-to-value
by choreography.
It yields in technical debt.
@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
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
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
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
Order
Fulfillment
Extract the domain logic around order fulfillment
Checkout
Payment
Inventory
Shipment
Payment
received
Order
placed
Retrieve
payment
@berndruecker
Order
Fulfillment
Decide about responsibility
Checkout
Payment
Inventory
Shipment
Payment
received
Order
placed
Retrieve
payment
@berndruecker
This is
choreography
This is
orchestration
My definition
Orchestration = command-driven communication
Choreography = event-driven communication
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.
Order
It is not about the protocol!
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
It can still be messaging!
@berndruecker
Communication vs. Collaboration Style
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!
See https://www.slideshare.net/BerndRuecker/jcon-2021-loosely-or-lousily-coupled
Order
Fulfillment
Checkout
Payment
Inventory
Shipment
Orchestration can be stateful / long running
This orchestration
requires state
@berndruecker
Warning:
Contains Opinion
@berndruecker
mail@berndruecker.io
@berndruecker
http://berndruecker.io/
Bernd Ruecker
Co-founder and
Chief Technologist of
Camunda
Order
Fulfillment
Checkout
Payment
Inventory
Shipment
@berndruecker
Glue code (e.g. Java)
https://github.com/berndruecker/flowing-
retail/blob/master/kafka/java/order-
zeebe/src/main/java/io/flowing/retail/kafka/or
der/flow/FetchGoodsAdapter.java
Using a workflow engine
Workflow Engine
Scheduler
Durable State
Glue Code Whatever you
need…
Workflow Definition
Workflow Engine:
Is stateful
Can wait
Can retry
Can escalate
Can compensate
Provides visibility
Now it is easy to change the orchestration logic
@berndruecker
Processes are domain logic and live inside service boundaries
@berndruecker
Processes are domain logic and live inside service boundaries
@berndruecker
Orchestration
does not
need to be
central
Challenge:
Command vs. Event
Event
Command
vs
?
Event Command
Message Record Event
Fact,
happened in the past,
immutable
Intend,
Want s.th. to happen,
The intention itself is a fact
?
Event Command
Message Record Event
Commands in disguise
The Customer Needs To Be
Sent A Message To Confirm
Address Change
Event
Send
Message
Wording of
Sender
Wording of
recipient
Checkout Order Payment
Event-driven:
Decision to couple is on the receiving side
Command-driven
Decision to couple is on the sending side
Direction of dependency
Retrieve
Payment
Order
placed
Payment
received
Direction of dependency
Coupling
Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
Types of Coupling
Type of coupling Description Example Recommendation
Implementation Coupling Service knows internals of
other services
Joined database Avoid
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
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
This is influenced with the communication
or collaboration style
Can be also reduced by other means
than asynchronous messaging!
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
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
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
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
Customer Created
Sam Newman: Building Microservices
Customer Onboarding is a mix!
Orchestration
Orchestration
Orchestration
Choreography
Order
Order
Notification
Notification
Payment
Send
legal docs
Payment
received
Order
placed
Send
email
It is all about responsibility!
Long running capabilities
are essential to design
good service boundaries
(= a good architecture)
@berndruecker
Example
Order
Fulfillment
Payment
Retrieve
Payment
@berndruecker
Example
Order
Fulfillment
Payment
Credit
Card
Retrieve
Payment
@berndruecker
Example
Order
Fulfillment
Payment
Credit
Card
Retrieve
Payment
Rejected
@berndruecker
Example
Order
Fulfillment
Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
Example
Order
Fulfillment
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?
Order
Fulfillment
Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
Payment
failed
(Potentially) long running services
Order
Fulfillment
Payment
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
retrievePayment
HTTP 200 OK
HTTP 202 ACCEPTED
Payment
Happy case: Synchronous response
Otherwise: asynchronous
Embrace asynchronicity
Designing good service boundaries
Order
Fulfillment
Payment
Credit
Card
@berndruecker
Business Unit
or Domain
Business Unit
or Domain
Business Unit
or Domain
Process Automation
Center or Excellence
Solution
Delivery
Solution
Delivery
Solution
Delivery
Solution
Delivery
Solution
Delivery
enable Provide custom
connectors
Provide process
orcherstration
as a service
…
@berndruecker
Center of
Excellence
Domain
Photo by born1945, available under Creative Commons BY 2.0 license.
Golden Paths
https://engineering.atspotify.com/2020/08/how-we-use-golden-paths-to-solve-fragmentation-in-our-software-ecosystem/
“We found that
rumour-driven development
simply wasn’t scalable”
@berndruecker
https://backstage.io/ (OSS, Made with ❤️ at Spotify) @berndruecker
Photo by born1945, available under Creative Commons BY 2.0 license.
Domain A
Domain B
# Orchestration != central
# Choreography != decoupled
# Orchestration = Command-driven
# Choreography = Event-driven
# You need to balance both!
# It is about responsibility and the direction of coupling
# You need long running capabilities to design good boundaries
# Some central capability for providing infrastructure helps
@berndruecker
Want To Know More?
Thank you!
@berndruecker
bernd.ruecker@camunda.com
@berndruecker
https://berndruecker.io
https://blog.bernd-ruecker.com/
https://github.com/berndruecker
Contact:
Slides:
Blog:
Code:
https://ProcessAutomationBook.com/

iSAQB Software Architecture Gathering 2023: How Process Orchestration Increases Agility Without Harming Architecture