Download presentation
Presentation is loading. Please wait.
1
Pragmatic Event-Driven Microservices
Allard Buijze –
2
Service Service Service
3
‘Normal’ SQL QUERY 22 JOINS 6 SUBQUERIES
4
Layered architecture User Interface Domain Model Service Layer
Data Access Layer Domain Model Method invocation Cache Worker pools Web Cache Session replication Distributed 2nd level cache Query Cache
6
Source: http://www.sabisabi.com/images/DungBeetle-on-dung.JPG
7
AxonFramework
8
Monoliths St Breock Downs Monolith -
9
Microservices vs Monoliths
Almost all the successful microservice stories have started with a monolith that got too big and was broken up 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. Martin Fowler Source:
10
Are you tall enough? Source: martinfowler.com/bliki/MicroservicePrerequisites.html
11
Microservice journey
12
Command Query Responsibility Segregation
Events Command model Projections Client
13
Location transparency
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) A Component should not be aware, nor make any assumptions, of the location of Components it interacts with
14
Reasons to send a message
Event Something has happened
15
‘Event-Driven’ Microservices
OrderCreated ItemAdded ItemRemoved OrderConfirmed Order service Need to know ordered items
16
3 reasons to send a message
Event Something has happened Command I want the system to do something Query I want to know something
17
Something has happened - Event
Data change Deadline passing Or anything else that’s relevant in the domain
18
Publish-subscribe Want to know Something happened! Want to know
19
Exclusive consumers One of us wants to know Something happened!
Want to know
20
Competing consumers One of us wants to know Something happened!
Want to know
21
Balanced consumers One of us wants to know If (%) Something happened!
Want to know
22
I want something done - Command
Request-a-side-effect Change data / application state Send Exactly 1 destination OK / NOK reply Maybe some data
23
Command Routing Can do something Can do something Do something!
24
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
25
Query – point to point Result = Price Price = 49
26
Query – scatter-gather
Price = 199 Result = Min(Price) (wait 100ms) If (…) Price = 149
27
Query – scatter-gather
Price = 199 Result = Min(Price) (wait 100ms) If (…) Price = 99 If (…) Price = 149
28
‘Event-Driven’ Microservices
OrderCreated OrderConfirmed ItemAdded GetOrderDetails ItemRemoved OrderDetails OrderConfirmed Order service Need to know ordered items
29
At scale, different rules apply
30
How do you route all events to all components? How will this scale?
31
You Don't! It Won't!
32
As shipping module, I want to know when an order is placed
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
33
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.
34
Within a context, share ‘everything’
35
Between contexts, share ‘consciously’
As shipping module, I want to know when an order is placed Order Created + Item Added + Order Confirmed Order Placed Order Created Item Added to Order Shipping Address Added Billing Address Added Order Confirmed
36
Where does Axon Framework fit?
Inside each component in bounded context Axon provides the Java APIs towards platform EventBus, CommandBus, QueryBus Separation of business logic and infrastructure logic
37
It’s hard to get messaging right
38
We’re all solving the same problems
39
“Just enough” intelligence
AxonIQ Messaging Platform Understands difference between Commands, Events, Queries and their routing patterns. Does not care about the content of these messages. Message Broker Sends messages. Main value add is reliability. Enterprise Service Bus Understands message content. Hard to configure and maintain. dumb smart
40
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.
41
More info? Too late for that now… AxonFramework.org AxonIQ.io
Allard Buijze @allardbz Visit our booth Too late for that now…
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.