SlideShare a Scribd company logo
Opportunities & Pitfalls
of
Event-Driven Utopia
@berndruecker
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
event-driven-benefits-pitfalls/
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Why this talk
Why this talk
Service 1
Agenda
Service 2
Events on the inside
Events on the outside
1
3
Service 1
Agenda
Service 2
Events on the inside
Events on the outside
1
3
Events inside out2
Service 1
Agenda
Service 2
Events on the inside1
Events on the outside3
Events inside out2
Once upon a time…
RDMS
Application
Client
BBC architecture
(box - arrow – box – arrow - cylinder)
Every architecture diagram
you'll ever need
The great thing about this architecture
RDMS
Application
DB gurantees
(e.g. ACID)
The problem
not webscale
resiliency is expensive
RDMS
Application
RDMS
Pat Helland
https://vimeo.com/52831373
Append-only
Log
…
bank
account
created
+2,500 $
transfered
-14.99$
paid by
credit card
…
Persistent change
RDMS
Account # Balance
12345 2,500$
Persistent state
Current Balance =
2,485.01 $
Append-only
Log
…
bank
account
created
+2,500 $
transfered
-14.99$
paid by
credit card
…
Persistent change Event
Bank Account Created
2019/04/16 11:00
# 12345
Event
Money Transfer Received
2,500$
2019/04/16 11:00
# 12345
Event Sourcing in a nutshell
Customer
Business
Logic
Save
event
2. Read events
Replay
…
Internal State
3. Build
internal state
5. Add Customer Created Event
1. Create Customer 4. Validation and
Invariant Checks
e.g. Customer Created, Customer Credit Limit Approved, …Customer Event Store
6. Async publish
Customer Created Domain Event
Working without distributed transactions
Customer
Business
Logic
Save
event
2. Read events
Replay
…
Internal State
3. Build
internal state
5. Add Customer Created Event
1. Create Customer 4. Validation and
Invariant Checks
e.g. Customer Created, Customer Credit Limit Approved, …Customer Event Store
6. Async publish
Customer Created Domain Event
This is the only
atomic operation
required
Traditional Architecture
Customer
1. Create Customer
Account
RDMS
Business
Logic
Open
Account
2. Persist state
changes
3. Remote
Communication
Pat Helland
“
Distributed Systems Guru
Worked at Amazon,
Microsoft & Salesforce
@berndruecker
Pat Helland
Grown-Ups Don’t Use
Distributed Transactions
“
Distributed Systems Guru
Worked at Amazon,
Microsoft & Salesforce
Open
Account
Outbox pattern in traditional architectures
Customer
1. Create Customer
Account
RDMS
Business
Logic
Job:
„Open
Account“
2. Persist state
changes
3. Remote
CommunicationExecute:
„Open
Account“
TX 1 TX 2
Async after first
transaction!
Outbox pattern – Implementation Approaches
Scheduler
Database
Transaction Log
Workflow
Automation
Idempotency
Customer
1. Create
Customer
Account
RDMS
Business
Logic
Job:
„Open
Account“
2. Persist state
changes
3. Remote
Communication
Async after
transaction!
Execute:
„Open
Account“
Capture
Request
TX 1 TX 2
Idempotency
Customer
1. Create
Customer
Account
RDMS
Business
Logic
Job:
„Open
Account“
2. Persist state
changes
3. Remote
Communication
Async after
transaction!
Execute:
„Open
Account“
Capture
Request
TX 1 TX 3TX 2
Working without distributed transactions
Customer
Business
Logic
Save
event
2. Read events
Replay
…
Internal State
3. Build
internal state
5. Add Customer Created Event
1. Create Customer 4. Validation and
Invariant Checks
e.g. Customer Created, Customer Credit Limit Approved, …Customer Event Store
6. Async publish
Customer Created Domain Event
This is the only
atomic operation
required
Events on the inside.
An example from my world
mail@berndruecker.io
@berndruecker
Bernd Ruecker
Co-founder and
Chief Technologist of
Camunda
We offer two different workflow engines. Why?
Camunda ZeebePersistent
State
Persistent
change
Workflow
Instance
Id
Current
Activity
State
2 RetrievePayment running
Workflow
Instance
Id
Current
Activity
State
2 ShipGoods running
Workflow
Instance
Id
Current
Activity
State
2 OrderDelivered ended
2.
3. UPDATE
2. UPDATE
1. INSERT
3.1.
RDMS
Workflow
Engine
Append-only
Log1.
create
workflow
instance
workflow
instance
created
start
event
occured
sequence
flow taken
activity
activated
task
created
lock
created
task
locked
complete
task
task
completed
activity
completed
sequence
flow taken
…
…
2.
2.
1.
Workflow
Engine
Event Handling, Replication & Single Writer
Follower
Follower
complete task
command
task completed
event
1 send
2 append command
Broker
(Leader)
Stream
Processor
4 process
7
store & replicate
event
6 append event
3
store & replicate
command
5 respond
Single Writer
(single thread)
What we do different
Follower
Follower
complete task
command
task completed
event
1 send
2 append command
Leader
Stream
Processor
4 process
7
store & replicate
event
6 append event
3
store & replicate
command
5 respond
Single Writer
(single thread)
Store and replay
commands
Delete records that
are fully processed
Persist & replicate
internal state
Consistency
Availability
Partition
Zeebe is CP
Follower
Follower
complete task
command
task completed
event
1 send
2 append command
Leader
Stream
Processor
4 process
7
store & replicate
event
6 append event
3
store & replicate
command
5 respond
Single Writer
(single thread)
Horizontal scalability by partitioning
Partition 1
Partition 2
Partition 3
Partition 4
Every workflow instance is
exactly handled by one
partition
instance id: 2-42
instance id: 3-66
Stream
Processor Single Writer
(single thread)
Queries and
read models
Zeebe
Broker
Zeebe
Broker
Streaming
Exporter
ask
ask
Recap 1 – Events on the inside
# Natural mechanism to build scalable services in distributed
systems (with Outbox & co included)
But
# You have to think about reads, queries & eventual consistency
# Much less industry experience available
@berndruecker
Service 1
Agenda
Service 2
Events on the inside
Events on the outside
1
3
Events inside out2
Event Store and Messaging
Customer
…
1. Create Customer
Customer Event Store
Merge Messaging and Event Store
Customer
…
1. Create Customer
Customer Event Store
Merge messaging and event store
Customer
…
1. Create Customer
Shared Event Store
Enter the world of Kafka…
Merge messaging and event store
Customer
…
1. Create Customer
Shared Event Store
Kafka as transport
Customer
…
1. Create Customer
Used as queue (but persistent!)
Service 1
Agenda
Service 2
Events on the inside
Events on the outside
1
3
Events inside out2
Once upon a time
Billing
Customer
Change
Address
Event Notification
Address
changed
Billing
Customer
Event Notification
Address
changed
Billing
Customer
Billing
Customer
Reverse direction
of dependency
direction
of dependency
Change
Address
Event Notification
Address
changed
Billing
Customer AdressChanged
{
customerId: 42
}
Ask for
details
Event-carried State Transfer
Address
changed
Billing
Customer
AddressChanged
{
customerId: 42,
address: ...
}
CustomerChanged
{
customerId: 42,
status: A,
address:
...,
}
AddressChanged
{
customerId: 42,
oldAddress: ...
newAddress: ...
}
CustomerMoved
{
...,
This decision is complex
Address
changed
Billing
Customer
Billing
Customer
Reverse direction
of dependency
direction
of dependency
Change
Address
Example
Change Address
Address
Submit
From bla@company.com
Date 2019-04-23 09.05
To confirm your address change please click on this link:
http://company.com/confirm?id=82e97d49-166c-4862-
9973-4db348e6225d
Incoming Email
Example
Customer
Notification
Address change
confirmed
Change Adress
Address change
requested
http://company.com/confirm?id=82e97
d49-166c-4862-9973-4db348e6225d
direction of dependency
Example
Customer
Notification
‚Confirmation‘
approved
Change Adress
http://company.com/confirm?id=82e97
d49-166c-4862-9973-4db348e6225d
Send mail
‚Confirmation‘
Address
changed
direction of dependency
Challenge:
Command vs. Event
Event
Command
vs
It is NOTabout communication protocols
Address
changed
Billing
Customer
Billing
Customer
Change
Address
It can be messaging,
REST, whatever, ….
Manifold ways of transport
…
Manifold ways of transport
…
?
Event Command Query
Message Record Event
Fact,
happened in the past,
immutable
Intend,
Want s.th. to happen,
The intention itself is a fact
?
Event Command Query
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
Examples
PaymentOrder
Subscription
Retrieve
Payment
More general,
does not need to know
who is retrieving payments
Customer
Order
Address
Changed
Billing
More general,
does not need to care about
who is interessted in address changes
Notification
Send
Mail
Global service
Order
Notification
Order
Placed
Payment
Received
Goods
Shipped
Service that can
handle notifications
for orders
autonomously
Distributed Monoliths
Authorization
Service
Document Context Page
Context
Document
attached
Page
created
Document
moved
Page
moved
…
Define stable contract/API instead
Authorization
Service
Document Context Page
Context
Add
auth
…
Next challenge:
Event chains
Event Chains
Adress
Check
Credit Check
Registration
@berndruecker
Customer
Event Bus
Registration
requested
Credit
checked
Address
checked
Customer
registered
Event Chains
Adress
Check
Credit Check
Registration
@berndruecker
Customer
Event Bus
Registration
requested
Credit
checked
Address
checked
Customer
registered
How does customer
registration work?
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
Monitoring Workflows Across Microservices
https://www.infoq.com/articles/monitor-workflow-collaborating-microservices
@berndruecker
Typical approachesDistributed Tracing
Data Lake / Event Monitoring
Process Mining
Process Tracking
@berndruecker
What we currently build with customers…
Camunda
Optimize
Elastic
Registration
requested
Credit
checked
Address
checked
Customer
registered
@berndruecker
All great – until you have to move…
Changes required for an additional check
Adress
Check
Credit Check
Registration
Criminal
Check
@berndruecker
Customer
Event Bus
Registration
requested
Credit
checked
Customer
registered
Address
checked
Changes required for an additional check
Adress
Check
Credit Check
Registration
Criminal
Check
@berndruecker
Customer
Event Bus
Registration
requested
Credit
checked
Customer
registered
Address
checked
Criminal
checked
Alternative flow
Adress
Check
Credit Check
Registration
Criminal
Check
@berndruecker
Customer
Kafka
Customer
registered
Registration
requested
Address
checked
Credit
checked
Criminal
checked
Alternative flow
Adress
Check
Credit Check
Registration
Criminal
Check
@berndruecker
Customer
Kafka
Customer
registered
Registration
requested
Address
checked
Credit
checked
Criminal
checked
„Credit checks got more
expensive, do that only if all
other checks succeed“
Keep it stable, just move
sticks with yellow color to the
top.
How hard
can it be?
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and Pedobear19 / CC BY-SA 4.0
@berndruecker
Orchestration
Adress
CheckCredit Check
Registration
Customer
Kafka
Registration
requested
Credit
checked
Address
checked
Customer
registeredCheck
credit
Check
address
Customer
checked
Customer
On-boarding
Of course these two
services could be merged
Changes
Adress
CheckCredit Check
Registration
Customer
Kafka
Registration
requested
Credit
checked
Address
checked
Customer
registeredCheck
credit
Check
address
Customer
checked
Customer
On-boarding
Criminal
Check
Crimes
checked
Check
crimes
Comparison
2 changes
criminal check can be deployed first
2 changes,
criminal check can be deployed first
See also https://www.infoworld.com/article/3391592/
how-to-tame-event-driven-microservices.html
In my world…
Customer
On-boarding
Leverage Workflow Engine & BPMN within Service
Customer On-boarding
Local Orchestration
Central
Orchestration
Service
Opportunities and Pitfalls of Event-Driven Utopia
Recap 2
# Commands vs. Events: Decide about the direction of
dependencies
# Beware of event-chains and avoid losing sight
# Balance choreography and orchestration
@berndruecker
Service 2Service 1
Recap
Events on the inside
Events on the outside
1
3
Persistent state vs persistent change
Event sourcing & Event Store
Consistency & CAP
Read Models & CQRS
Events as API
Event vs Command
Event chains & visibility
Orchestration vs Choreography
Shared Event Store
Events inside out2
Want to see code?
Nothing for the faint of heart…
Events on the inside
Events on the outside
Nothing for the faint of heart…
…but doable…
…and worth it
Thank you!
@berndruecker
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/
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
event-driven-benefits-pitfalls/

More Related Content

PDF
Automating Processes in Modern Architectures
PDF
AWS Community Summit London 2019 - Lost in transaction
PDF
Serverless London 2019 - Coordination of Serverless Functions
PDF
QCon 2019 - Opportunities and Pitfalls of Event-Driven Utopia
PPTX
Event Driven Architectures
PPTX
Event Driven Architectures - Phoenix Java Users Group 2013
PDF
Citi Tech Talk: Event Driven Kafka Microservices
PPTX
Microservices - Event-driven & the hidden landmines
Automating Processes in Modern Architectures
AWS Community Summit London 2019 - Lost in transaction
Serverless London 2019 - Coordination of Serverless Functions
QCon 2019 - Opportunities and Pitfalls of Event-Driven Utopia
Event Driven Architectures
Event Driven Architectures - Phoenix Java Users Group 2013
Citi Tech Talk: Event Driven Kafka Microservices
Microservices - Event-driven & the hidden landmines

Similar to Opportunities and Pitfalls of Event-Driven Utopia (20)

PDF
An eventful tour from enterprise integration to serverless and functions
PDF
Event Driven Architecture: Mistakes, I've made a few...
PDF
Techorama Event Based Architecture Chris van Zadel.pdf
PDF
How Events Are Reshaping Modern Systems
PDF
Apidays Paris 2023 - Kafka in Event-Driven Architectures, Hassane Moustapha, ...
PDF
Designing Events-First Microservices
PPTX
Brown bag eventdrivenmicroservices-cqrs
PDF
Designing Events-First Microservices For A Cloud Native World
PDF
Webinar: Monitoring & Orchestrating Your Microservices Landscape using Workfl...
PPTX
Increasing agility with php and kafka
PDF
Building an Enterprise Eventing Framework (Bryan Zelle, Centene; Neil Buesing...
PDF
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
PDF
Designing Events-first Microservices
PDF
#hacksummit 2016 - event-driven microservices – Events on the outside, on the...
PPTX
Digital Transformation Mindset - More Than Just Technology
PDF
Event Driven Architecture - Mistakes, I've made a few
PDF
The art of the event streaming application: streams, stream processors and sc...
PDF
Kafka summit SF 2019 - the art of the event-streaming app
PDF
Kafka as an event store - is it good enough?
PDF
[WSO2Con EU 2018] Building Reactive Applications Using Event Driven Architecture
An eventful tour from enterprise integration to serverless and functions
Event Driven Architecture: Mistakes, I've made a few...
Techorama Event Based Architecture Chris van Zadel.pdf
How Events Are Reshaping Modern Systems
Apidays Paris 2023 - Kafka in Event-Driven Architectures, Hassane Moustapha, ...
Designing Events-First Microservices
Brown bag eventdrivenmicroservices-cqrs
Designing Events-First Microservices For A Cloud Native World
Webinar: Monitoring & Orchestrating Your Microservices Landscape using Workfl...
Increasing agility with php and kafka
Building an Enterprise Eventing Framework (Bryan Zelle, Centene; Neil Buesing...
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Designing Events-first Microservices
#hacksummit 2016 - event-driven microservices – Events on the outside, on the...
Digital Transformation Mindset - More Than Just Technology
Event Driven Architecture - Mistakes, I've made a few
The art of the event streaming application: streams, stream processors and sc...
Kafka summit SF 2019 - the art of the event-streaming app
Kafka as an event store - is it good enough?
[WSO2Con EU 2018] Building Reactive Applications Using Event Driven Architecture
Ad

More from C4Media (20)

PDF
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
PDF
Next Generation Client APIs in Envoy Mobile
PDF
Software Teams and Teamwork Trends Report Q1 2020
PDF
Understand the Trade-offs Using Compilers for Java Applications
PDF
Kafka Needs No Keeper
PDF
High Performing Teams Act Like Owners
PDF
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
PDF
Service Meshes- The Ultimate Guide
PDF
Shifting Left with Cloud Native CI/CD
PDF
CI/CD for Machine Learning
PDF
Fault Tolerance at Speed
PDF
Architectures That Scale Deep - Regaining Control in Deep Systems
PDF
ML in the Browser: Interactive Experiences with Tensorflow.js
PDF
Build Your Own WebAssembly Compiler
PDF
User & Device Identity for Microservices @ Netflix Scale
PDF
Scaling Patterns for Netflix's Edge
PDF
Make Your Electron App Feel at Home Everywhere
PDF
The Talk You've Been Await-ing For
PDF
Future of Data Engineering
PDF
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Next Generation Client APIs in Envoy Mobile
Software Teams and Teamwork Trends Report Q1 2020
Understand the Trade-offs Using Compilers for Java Applications
Kafka Needs No Keeper
High Performing Teams Act Like Owners
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Service Meshes- The Ultimate Guide
Shifting Left with Cloud Native CI/CD
CI/CD for Machine Learning
Fault Tolerance at Speed
Architectures That Scale Deep - Regaining Control in Deep Systems
ML in the Browser: Interactive Experiences with Tensorflow.js
Build Your Own WebAssembly Compiler
User & Device Identity for Microservices @ Netflix Scale
Scaling Patterns for Netflix's Edge
Make Your Electron App Feel at Home Everywhere
The Talk You've Been Await-ing For
Future of Data Engineering
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Ad

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
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
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
Teaching material agriculture food technology

Opportunities and Pitfalls of Event-Driven Utopia