SlideShare a Scribd company logo
Long running processes
bernd.ruecker@camunda.com
With thoughts from http://flowing.io
@berndruecker | @martinschimak
AT&T
Assume you want
to build a Dash
button
pay receive
shipment
place
order
I want to have
one item!
I am happy!
Business Capabilities
Bounded
Contexts
Order
placed
Shop Payment Shipping
Business
Outputs /
Domain
Events
Inventory
Payment
received
Goods
picked
Goods
shipped
Implementation
<<root entity>>
Order
- items
- sum
- customerId
- ...
<<value object>>
Address
- zipCode
- ...
0..*
<<event>>
OrderCreated
- orderItems
- ...
Eventflow
Order
placed
Payment
received
Goods
fetched
Goods
shipped
InventoryPayment ShippingShop
Process Manager
Process Manager
• Do event command transformation
• Implement the flow as 1st class citizen of
domain logic
• Handle state for long running flows
Process Manager
• Do event command transformation
• Implement the flow as 1st class citizen of
domain logic
• Handle state for long running flows
Let‘s zoom in the payment context
Payment
Order
placed
Payment
received
Let‘s zoom in the payment context
Payment
Order
placed
Payment
received
The payment context
has to listen to
„order placed“ event
De-coupling?
Payment
Order
placed
Service
fullfilled
…
Whenever a new client requires
payment, the payment context
has to be touched
The payment context has to know
all possible events that trigger a
payment
Subscription
confirmed
Event command transformation
Payment
Retrieve
payment
Order
placed Transformation
Command
Something has to happen
in the future
1 recipient
Event
Something has happend
in the past
0..n recipients
Order context
Payment
Retrieve
payment
Order
placed Order
Event vs. command
Payment
Retrieve
payment
Order
placed Order
decide where to
do the coupling
Vaughn Vernon
„Process Managers
transform Events into
Commands“
At IDDD Workshop February 2017
Process Manager
• Do event command transformation
• Implement the flow as 1st class citizen
of domain logic
• Handle state for long running flows
Order context cares about the flow
Payment
Retrieve
payment
Order
placed Order
The flow as graphical, but directly executable model
It is about visibility!
It is about ubiquitous language!
Ubiquitous Language
Software
Experts
Domain
Experts
Martin Fowler
Event notification is nice because it implies a low level of
coupling, and is pretty simple to set up. It can become
problematic, however, if there really is a logical flow
that runs over various event notifications. The
problem is that it can be hard to see such a flow as it's
not explicit in any program text. Often the only way to
figure out this flow is from monitoring a live system.
This can make it hard to debug and modify such a flow.
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
New business requirements
Order
placed
Payment
received
Goods
fetched
Goods
shipped
InventoryPayment ShippingShop
VIP customers can order with
invoice (and pay later)
New business requirements
Order
placed
Payment
received
Goods
fetched
Goods
shipped
InventoryPayment ShippingShop
VIP customers can order with
invoice (and pay later)
If VIP
customer
If not VIP
customer
Order
billed
Billing
If VIP
customer
Adjusted flow
I was inspired by Greg Young's course at Skills Matter, see CQRS/DDD course. […] The
problem with our first implementation is that it misses a concept: there is no
notion of a process. In earlier solutions the process was hidden in the sense that
whenever a service thought it couldn't proceed, it would send out a message. E.g. Shop
would say it had a completed Order. This Order would then be picked up by Payment
and Fulfillment. Payment would allow a customer to pay and Fulfillment would have to
wait because it needed paid Orders. So when Payment was done it would send out a
PaymentReceived message that would allow Fulfillment to continue. This works but
Greg argues that this allows only a single process and that the solution would be
more flexible if we would have a process manager that delegates steps in the
process to different services, waiting for them to complete.
http://blog.xebia.com/refactoring-to-microservices-introducing-a-process-manager/
Process Manager
• Do event command transformation
• Implement the flow as 1st class citizen of
domain logic
• Handle state for long running flows
Example
Long running,
requires state handling
Potentially long running,
requires state handling
Long running flows have state
In DDD everything leaving the
aggregate scope is
potentially long running
Saga
The classical Saga pattern example
book
hotel
book
car
book
flight
cancel
hotel
cancel
car
1. 2. 3.
5.6.
4. In case of
failure trigger
compensations
book
trip
How to
implement?
Reactive actor with Akka
https://github.com/VaughnVernon/ReactiveMessagingPatterns_ActorModel/blob/master/src
/co/vaughnvernon/reactiveenterprise/processmanager/ProcessManager.scala#L91
State in entity
Routing slip
http://vasters.com/archive/Sagas.html
State machine
http://camunda.org/
Logic remains in normal code
Tools provide persistent state, visibility and more
Compensation
The power of graphics
Graphics
Code
http://vasters.com/archive/Sagas.html
Smells like
„BPM“?
The 7 sins of workflow and Java
Zero-code suites
Homegrown
engine
No engine Wrong engine Wrong usage
4
6
5
7
http://blog.bernd-ruecker.com/
Death by properties panel
Script:
Please enter your complex code here.
(Without IDE support of course!)
BPM Suites
By the way, we introduce an own
development approach, IDE, version
control, user management, reporting, …
Zero code & developers
We have a lot of
problems!
It totally sucks!
I hate BPM!
Bernd Rücker
Consultant & Evangelist
> 10+ years workflow
http://bernd-ruecker.com/
bernd.ruecker@camunda.com
Co-founder Camunda
http://camunda.org/
Long running processes in DDD
Define flows programatically or graphically
Define flows programatically or graphically
Todo…
Productive development and testing
Developer
friendly
Do it yourself? Actor
Entity
Routing Slip
© Picture from http://www.windtraveler.net/2010_06_01_archive.html
Think about subsequent requirements
Monitoring &
Operations
Visibility
Versioning
Time &
Timeouts
Domain Logic
Think about what you miss
The 7 sins of workflow
Zero-code suites
Homegrown
engine
Granularity
bloopers
BPM monolith Stakeholders
habitat violation
Over engineering
No engine Wrong engine Wrong usage
http://blog.bernd-ruecker.com/
4 5
7
The end-to-end process?
You are not forced to violate the bounded context!
Order Feedback
Inventory
Payment
Payment
Local flows in the bounded contexts
Order
Lightweight and embeddable engine
Engine must be
• easy to use
• developer friendly
also in the scope of multiple
scopes/aggregates/services
• technically
• license model
Payment
Order
engine
engine
…
Inventory
Shipping
…
engine
The 7 sins of workflow
Zero-code suites
Homegrown
engine
Granularity
bloopers
BPM monolith
No engine Wrong engine Wrong usage
http://blog.bernd-ruecker.com/
5
7
Slides are nice –
but what about code?
Sure:
http://github.com/flowing/
Demo architecture
InventoryPaymentOrder Shipping
H2
Shop Monitor
Camunda
Webapp
on Tomcat
for demo in single Java VM for simplicity
http://flowing.io/
Flows that
cross
aggregate
boundaries
State
Routing Slip
Entity
State machine or
embeddable
workflow engine
Actor
Clear ownership
and proper
couplingThe problem
Use Cases
Implemenation
approaches
Possible advantages
Monitoring & Operations
Visibility
Ubiquitious
language
Handling of time
& timeouts
Save
effort
Versioning
Saga
Human Task
Management
Service
Collaboration
Requirements
Lightweight state machines or
workflow engines are not evil!
They help you solve some coding
problems well.
Code online:
https://github.com/flowing
Slides online:
http://bernd-ruecker.com
Feedback:
http://bernd-ruecker.com/feedback
With thoughts from http://flowing.io
@berndruecker | @martinschimak
Thank you!

More Related Content

PPTX
JavaScript Promises
PDF
The Beginner’s Guide To Spring Cloud
PDF
NextJS, A JavaScript Framework for building next generation SPA
ODP
Introduction To RabbitMQ
PPTX
PPTX
An Introduction to Prometheus (GrafanaCon 2016)
PPTX
Nginx Reverse Proxy with Kafka.pptx
PPTX
Express js
JavaScript Promises
The Beginner’s Guide To Spring Cloud
NextJS, A JavaScript Framework for building next generation SPA
Introduction To RabbitMQ
An Introduction to Prometheus (GrafanaCon 2016)
Nginx Reverse Proxy with Kafka.pptx
Express js

What's hot (20)

PPTX
서버 아키텍처 이해를 위한 프로세스와 쓰레드
PPTX
Content Delivery Network - CDN
PPTX
Node.js Express
PDF
An introduction to React.js
PDF
REST APIs with Spring
PDF
Towards Functional Programming through Hexagonal Architecture
PDF
[수정본] 우아한 객체지향
PPTX
Intro to React
PDF
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
PPTX
An Introduction To REST API
PDF
Event Storming and Saga
PDF
Express node js
PPTX
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
PPTX
PDF
SOAP-based Web Services
PDF
이벤트 기반 분산 시스템을 향한 여정
PDF
Django Introduction & Tutorial
PDF
Apache Pulsar Development 101 with Python
PDF
gRPC Overview
PPTX
서버 아키텍처 이해를 위한 프로세스와 쓰레드
Content Delivery Network - CDN
Node.js Express
An introduction to React.js
REST APIs with Spring
Towards Functional Programming through Hexagonal Architecture
[수정본] 우아한 객체지향
Intro to React
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
An Introduction To REST API
Event Storming and Saga
Express node js
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
SOAP-based Web Services
이벤트 기반 분산 시스템을 향한 여정
Django Introduction & Tutorial
Apache Pulsar Development 101 with Python
gRPC Overview
Ad

Similar to Long running processes in DDD (20)

PDF
Goto meetup Stockholm - Let your microservices flow
PDF
JAX 2017 talk: Orchestration of microservices
PDF
JavaBin Oslo: Open source workflow and rule management with Camunda
PDF
MuCon London 2017: Break your event chains
PDF
DDD Belgium Meetup 2017: Events, flows and long running services
PDF
Master the flow of microservices - because your business is more complex than...
PDF
O'Reilly SA: Complex event flows in distributed systems
PDF
Complex event flows in distributed systems
PPT
20061122 JBoss-World Experiences with JBoss jBPM
PDF
Get Paid! Plugins, Gateways, BitCoin: WordPress Ecommerce Project Management
PDF
Communication between (micro-)services - Bernd Rücker - Codemotion Amsterdam ...
PDF
JCon Live 2023 - Lice coding some integration problems
PDF
O'Reilly SA NYC 2018: Complex event flows in distributed systems
PDF
Loosely or lousily coupled - Understanding communication patterns in microser...
PDF
Get Paid presentation_20190123
PDF
CamundaCon NYC 2023 Keynote - Shifting into overdrive with process orchestration
PDF
Scem Overview - PDF - Paresh Bhagwatkar
PDF
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
PDF
Workflow Engines & Event Streaming Brokers - Can They Work Together?
PDF
Versa cloud slide-deck-02-technical-introduction
Goto meetup Stockholm - Let your microservices flow
JAX 2017 talk: Orchestration of microservices
JavaBin Oslo: Open source workflow and rule management with Camunda
MuCon London 2017: Break your event chains
DDD Belgium Meetup 2017: Events, flows and long running services
Master the flow of microservices - because your business is more complex than...
O'Reilly SA: Complex event flows in distributed systems
Complex event flows in distributed systems
20061122 JBoss-World Experiences with JBoss jBPM
Get Paid! Plugins, Gateways, BitCoin: WordPress Ecommerce Project Management
Communication between (micro-)services - Bernd Rücker - Codemotion Amsterdam ...
JCon Live 2023 - Lice coding some integration problems
O'Reilly SA NYC 2018: Complex event flows in distributed systems
Loosely or lousily coupled - Understanding communication patterns in microser...
Get Paid presentation_20190123
CamundaCon NYC 2023 Keynote - Shifting into overdrive with process orchestration
Scem Overview - PDF - Paresh Bhagwatkar
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
Workflow Engines & Event Streaming Brokers - Can They Work Together?
Versa cloud slide-deck-02-technical-introduction
Ad

More from Bernd Ruecker (20)

PDF
QCon London: Mastering long-running processes in modern architectures
PDF
WeAreDevelopers Live 2024 - Mastering long-running processes in modern archit...
PDF
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
PDF
JFall - Process Oriented Integration
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
JFS 2021 - The Process Automation Map
PDF
JCon 2021 - 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
Process Automation Forum April 2021 - Practical Process Automation
PDF
Micronaut Webinar 2021 - Process Automation Introduction
PDF
Webinar "Communication Between Loosely Coupled Microservices"
PDF
Automating Processes in Modern Architectures
PDF
OOP 2021 - Leverage the full potential of your hipster architecture
PDF
GOTOpia 2020 - Balancing Choreography and Orchestration
QCon London: Mastering long-running processes in modern architectures
WeAreDevelopers Live 2024 - Mastering long-running processes in modern archit...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
JFall - Process Oriented Integration
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
JFS 2021 - The Process Automation Map
JCon 2021 - Loosely or lousily coupled
CamundaCon 2021 Keynote :From Human Workflow to High-Throughput Process Autom...
Kafka Summit 2021 - Apache Kafka meets workflow engines
Process Automation Forum April 2021 - Practical Process Automation
Micronaut Webinar 2021 - Process Automation Introduction
Webinar "Communication Between Loosely Coupled Microservices"
Automating Processes in Modern Architectures
OOP 2021 - Leverage the full potential of your hipster architecture
GOTOpia 2020 - Balancing Choreography and Orchestration

Recently uploaded (20)

PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Spectroscopy.pptx food analysis technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Electronic commerce courselecture one. Pdf
PDF
Approach and Philosophy of On baking technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
Teaching material agriculture food technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Machine Learning_overview_presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Spectroscopy.pptx food analysis technology
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
A comparative analysis of optical character recognition models for extracting...
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Teaching material agriculture food technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Machine Learning_overview_presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation

Long running processes in DDD