SlideShare a Scribd company logo
Pragmatic Event-Driven
Microservices
Allard Buijze
@allardbz – allard@axoniq.io
Service
Service
Service
‘Normal’ SQL QUERY
22 JOINS 6 SUBQUERIES
Layered architecture
User Interface
Service Layer
Data Access Layer
DomainModel
Method invocation Cache
Worker pools
Web
Cache
Session replication
Distributed 2nd level cache Query Cache
Pragmatic Event Driven Microservices
Pragmatic Event Driven Microservices
Source: http://www.sabisabi.com/images/DungBeetle-on-dung.JPG
AxonFramework
Command Query Responsibility
Segregation
Command
model
Projections
Client
Events
Monoliths
St Breock Downs Monolith - www.cornwalls.co.uk
Microservices vs Monoliths
Microservices system
Almost all the cases where I've heard of a system that was built as a
microservice system from scratch, it has ended up in serious trouble.
Monoliths
Almost all the successful microservice stories have started with a
monolith that got too big and was broken up
Martin Fowler
Source: http://martinfowler.com/bliki/MonolithFirst.html
Are you tall enough?
Source: martinfowler.com/bliki/MicroservicePrerequisites.html
Noun Driven Design
Noun?  Service!
Noun Driven Design
OrderService
Noun Driven Design
CustomerService
Noun Driven Design
ProductService
Noun Driven Design
InventoryService
Noun Driven Design

$
Location transparency
A Component should not be aware, nor make any
assumptions, of the location of Components it
interacts with
A component should neither be aware of nor make any
assumptions about the location of components it interacts with.
Location transparency starts with good API design
(but doesn’t end there)
‘Event-Driven’ Microservices
• Event Something has happened
‘Event-Driven’ Microservices
Need to know
ordered items
Order service
OrderCreated 
ItemAdded 
ItemRemoved 
OrderConfirmed 
Or worse…
Shipping
Service
Order service
OrderCreated 
 InventoryConfirmed
ReadyForShipping 
 OrderShipped
Payment service
OrderPaid 
 ReadyForPayment
Reasons to send a message
• Event Something has happened
• Command I want the system to do something
• Query I want to know something
Something has happened - Event
• Data change
• Deadline passing
• Or anything else that’s relevant in the domain
Want to know
Want to know
Want to know
Something
happened!
Publish-subscribe
One of us
wants to know
Want to know
One of us
wants to know
Something
happened!
Exclusive consumers
One of us
wants to know
Want to know
One of us
wants to know
Something
happened!
Competing consumers
One of us
wants to know
Want to know
One of us
wants to know
Something
happened!
Balanced consumers
If (%)
I want something done - Command
• Request-a-side-effect
• Change data / application state
• Send email
• Exactly 1 destination
• OK / NOK reply
• Maybe some data
Can do
something
Can do
something
Can do
something
Do something!
Command Routing
Can do
something
Can do
something
Can do
something
Do something!
Command Routing
if (%)
I want to know something - Query
• Desire for information
• The response has more value than the question
• (Usually) side-effect free
• Different messaging patterns
• Single destination
• Scatter – gather query
• Subscription
Price = 49Result = Price
Query – point to point
Price = 199
If (…)
Price = 149
Query – scatter-gather
Result = Min(Price)
(wait 100ms)
Price = 199
If (…)
Price = 149
If (…)
Price = 99
Query – scatter-gather
Result = Min(Price)
(wait 100ms)
Query – subscription
Price = 49
Result = Price +
sum(Δ)
Price = 39
Δ = -10
OrderConfirmed 
‘Event-Driven’ Microservices
Need to know
ordered items
Order service
ItemAdded 
ItemRemoved 
OrderConfirmed 
OrderCreated 
 GetOrderDetails
OrderDetails 
Events retain value
Event Sourcing is an Architectural pattern in which Events are considered
the “source of truth”, based on which components (re)build their internal
state.
Event Store
An Event Store stores the published events to be retrieved both
by consumers as well as the publishing component itself.
OrderConfirmed 
Event Sourcing
Some smart
analytics
Order service
ItemRemoved 
OrderCreated 
OrderDetails 
Event Store operations
• Append
• Validate ‘sequence’
Event Store operations
• Full sequential read
Event Store operations
• Read aggregate’s events
1. Define which routing patterns to apply
2. Choose technology/protocol accordingly
At scale, different rules apply
How do you route all these
events to all components?
How will this scale?
You Don't!
It Won't!
Unmanageable mess
Order Created
Item Added to Order
Shipping Address Added
Billing Address Added
Order Confirmed
As shipping
module, I want to
know when an
order is placed
Bounded context
Explicitly define the context within which a model applies.
Explicitly set boundaries in terms of team organization, usage
within specific parts of the application, and physical
manifestations such as code bases and database schemas. Keep
the model strictly consistent within these bounds, but don’t be
distracted or confused by issues outside.
Within a context, share ‘everything’
Between contexts, share
‘consciously’ As shipping
module, I want to
know when an
order is placed
Order Created
Item Added to Order
Shipping Address Added
Billing Address Added
Order Confirmed
Order Created
+ Item Added
+ Order Confirmed
 Order Placed
Between contexts, share
‘consciously’ As shipping
module, I want to
know when an
order is placed
Order Created
Item Added to Order
Shipping Address Added
Billing Address Added
Order Confirmed
Order Confirmed
+ Get Order Details
 Order Placed
Where does AxonFramework fit?
• Inside each component in bounded context
• Axon provides the Java APIs towards platform
• EventBus, CommandBus, QueryBus
• Separation of business logic and infrastructure logic
Microservices Messaging
“Just enough” intelligence
dumb smart
Message Broker
Sends messages. Main
value add is reliability.
Enterprise Service Bus
Understands message
content. Hard to configure
and maintain.
AxonHub
Understands difference between Commands,
Events, Queries and their routing patterns.
Does not care about the content of these
messages.
Our mission
Provide the APIs and implementations necessary for event-
driven microservices to cooperate harmoniously, allowing each
of them to focus on the business logic.

More Related Content

Similar to Pragmatic Event Driven Microservices (20)

PPTX
Microservices, containers and event driven architecture - key factors in agil...
Judy Breedlove
 
PDF
Microservices, containers and event driven architecture - key factors in agil...
Judy Breedlove
 
PDF
1. Why Event-Driven Microservices _ Building Event-Driven Microservices.pdf
RajeevKumarSingh87
 
PPTX
Autonomous microservices for a Financial System
INPAY
 
PPTX
Event-Based API Patterns and Practices
LaunchAny
 
PPTX
Designing microservices part2
Masashi Narumoto
 
PPTX
Event Driven Microservices Presentation.
Knoldus Inc.
 
PDF
Microservices, containers and event driven architecture - key factors in agil...
Judy Breedlove
 
PPTX
Patterns of Distributed Application Design
Orkhan Gasimov
 
PPTX
Introduction to Microservices Patterns
arconsis
 
PPTX
Introduction to Microservices Patterns
Dimosthenis Botsaris
 
PDF
Patterns of Distributed Application Design
GlobalLogic Ukraine
 
PDF
Microservices as an evolutionary architecture: lessons learned
Luram Archanjo
 
PDF
Designing Events-first Microservices
J On The Beach
 
PPTX
Using Event Streams in Serverless Applications
Jonathan Dee
 
PDF
Cloud-Native Streaming and Event-Driven Microservices
VMware Tanzu
 
PDF
Design Microservice Architectures the Right Way
C4Media
 
PPTX
Architecting Microservices in .Net
Richard Banks
 
PPTX
Let's talk about... Microservices
Alessandro Giorgetti
 
PDF
Modernising Change - Lime Point - Confluent - Kong
confluent
 
Microservices, containers and event driven architecture - key factors in agil...
Judy Breedlove
 
Microservices, containers and event driven architecture - key factors in agil...
Judy Breedlove
 
1. Why Event-Driven Microservices _ Building Event-Driven Microservices.pdf
RajeevKumarSingh87
 
Autonomous microservices for a Financial System
INPAY
 
Event-Based API Patterns and Practices
LaunchAny
 
Designing microservices part2
Masashi Narumoto
 
Event Driven Microservices Presentation.
Knoldus Inc.
 
Microservices, containers and event driven architecture - key factors in agil...
Judy Breedlove
 
Patterns of Distributed Application Design
Orkhan Gasimov
 
Introduction to Microservices Patterns
arconsis
 
Introduction to Microservices Patterns
Dimosthenis Botsaris
 
Patterns of Distributed Application Design
GlobalLogic Ukraine
 
Microservices as an evolutionary architecture: lessons learned
Luram Archanjo
 
Designing Events-first Microservices
J On The Beach
 
Using Event Streams in Serverless Applications
Jonathan Dee
 
Cloud-Native Streaming and Event-Driven Microservices
VMware Tanzu
 
Design Microservice Architectures the Right Way
C4Media
 
Architecting Microservices in .Net
Richard Banks
 
Let's talk about... Microservices
Alessandro Giorgetti
 
Modernising Change - Lime Point - Confluent - Kong
confluent
 

Recently uploaded (20)

PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Ad

Pragmatic Event Driven Microservices