@allardbz
Allard Buijze
@allardbz
Event-Driven Microservices
with Axon and Spring Boot
Excitingly boring!
@allardbz
> java –jar my_awesome_app.jar
Hello world!
> _
> _
@allardbz
Production is no place
for excitement!
@allardbz
“Universal ‘BBC’ architecture”
Box Box Cylinder
Source: Ted Neward
@allardbz
Source: http://www.sabisabi.com/images/DungBeetle-on-dung.JPG
@allardbz
“Universal Microservices
architecture”
@allardbz
Number of deployment units
Modularity
“Evil anti-modularity forces”
@allardbz
$
@allardbz
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)
@allardbz
Microservices Messaging
Commands Events Queries
Route to single handler
Use consistent hashing
Provides confirmation/result
Distribute to all logical handlers
Consumers express ordering req’s
No results
Route with load balancing
Sometimes scatter/gather
Provides result
"Event" and “Message" is not the same thing
@allardbz
Explicit messaging
Demo…
@allardbz
Command Query Responsibility
Segregation
Command
model
Projections
Client
Events
Complex
Deployed often
Simple
Rarely depoyed
Seasonal usage
peaks
Unstable, memory
aggressive
@allardbz
Accidental complexity
Useful for queries.
Not for making decisions!
@allardbz
Applying CQRS
Demo…
@allardbz
Events…
• How do we guarantee atomic publication of
events and state change commits?
• How do we guarantee that our events are a
truthful representation of an entity’s history
@allardbz
Event Sourcing:
the truth,
the whole truth,
nothing but the truth
@allardbz
State storage Event Sourcing
Event Sourcing
• OrderCreated (id: 123)
• ItemAdded (2x Deluxe Chair, €399)
• ItemRemoved (1x Deluxe Chair, €399)
• OrderConfirmed
• OrderShipped
• OrderCancelledByUser
• ReturnShipmentReceived
• id: 123
• items
– 1x Deluxe Chair - € 399
• status: return shipment rcvd
@allardbz
The value of Event Sourcing
• Audit trail
• Analytics
• Improve modeling
• Given-when-testing
• …
@allardbz
The power of…
Not now
@allardbz
Event Sourcing
Demo…
@allardbz
Replays
Event Handler
Projection
Event Handler
Projection
@allardbz
Implement new projection
Demo…
@allardbz
@allardbz
Streaming to the UI
User
Interface
Event Handler BikeRentedEventBikeRentedEvent
{
bikeId: 1324,
location: Barcelona,
renter:
}
Steven
@allardbz
Subscription queries
Demo…
@allardbz
$
You are here…
@allardbz
@allardbz
Exchange
Queue
Queue
Event Store
@allardbz
@allardbz
Distributing components
Live coding…
@allardbz
@allardbz
@allardbz
@allardbz
Tracing
Live coding…
@allardbz
Try it yourself
• Sources:
• https://github.com/abuijze/bike-rental-demo (‘springio’ branch)
• https://github.com/AxonFramework/AxonFramework
• Download Axon
• axoniq.io/download (includes quick-start-guide)
Allard Buijze
@allardbz
Thanks!
Q&A

Event driven microservices with axon and spring boot-excitingly boring