Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions...
Transcript of Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions...
![Page 1: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/1.jpg)
Innovative solutions with Axon Framework
Allard Buijze – [email protected] – @allardbz At ANWB, Casumo, Gerimedica, Bridge Big
![Page 2: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/2.jpg)
Four cases
![Page 3: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/3.jpg)
Casumo
Online Casino
Games, Slot machines
High volumes
Auditing requirements
“Keep the spin button FAST!”
![Page 4: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/4.jpg)
ANWB
Emergency assistance call-center
Task based system
3rd party integrations
Reporting requirements
Somewhat predictable peak-loads
![Page 5: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/5.jpg)
Bridge Big
Online Bridge platform
Participants play for money
Large-scale tournaments
Elastically scalable
“Keep the game flowing smoothly”
![Page 6: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/6.jpg)
Gerimedica
Electronic Medical Record
SaaS solution
Many integrations
High availability
Medical analysis on historic data
“Improve healthcare through technology and sharing knowledge”
![Page 7: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/7.jpg)
What connects these cases?
?
![Page 8: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/8.jpg)
Complex domain model
![Page 9: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/9.jpg)
Complex environment
![Page 10: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/10.jpg)
Value in history
![Page 11: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/11.jpg)
Performance expectations
![Page 12: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/12.jpg)
Avoid the Big ball of “Mud”
Source: http://www.sabisabi.com/images/DungBeetle-on-dung.JPG
![Page 13: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/13.jpg)
Microservice Architecture
Source: http://martinfowler.com/articles/microservices.html
![Page 14: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/14.jpg)
Microservices vs Monoliths
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.
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
![Page 15: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/15.jpg)
A Monolith is not (always) a Big Ball of Mud
St Breock Downs Monolith - www.cornwalls.co.uk
![Page 16: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/16.jpg)
Desired evolution
1 – Build a monolith 2 – Extract components 3 – Extract more 4 – Scale as needed
![Page 17: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/17.jpg)
Axon Framework
“CQRS Framework” for Java
Open source (Apache 2 License)
Simplify CQRS based applications
Building blocks common in CQRS-based architectures
3.0-M1 released on 10th June, 2016
axonframework.org
![Page 18: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/18.jpg)
Axon Framework – Core Principles
Message oriented
Events Commands
Location transparency
Separate infrastructure from business logic
Customizable
Configure to match your infrastructure, not vice versa
![Page 19: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/19.jpg)
CQRS
![Page 20: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/20.jpg)
CQRS Based Architecture
Command model Projections
![Page 21: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/21.jpg)
CQRS Based Architecture
Command model Projections
T: 1 mln / s Resp: < 10 ms
T: Thr. 20 / s Resp: < 100 ms
T: 10 mln / s Resp. < 100 ms
T: 1 / s Resp. < 10 ms
![Page 22: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/22.jpg)
Synchronizing models
Command model Projections
Events
![Page 23: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/23.jpg)
CQRS Based Architecture
![Page 24: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/24.jpg)
Separate infrastructure from business logic
A
D
B
E
C
![Page 25: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/25.jpg)
Spring configuration - Simple
EmbeddedEventStore
TrackingEventProcessor
SimpleCommandBus
![Page 26: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/26.jpg)
Separate infrastructure from business logic
A
D
B
E
C
![Page 27: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/27.jpg)
Separate infrastructure from business logic
A
D
B
E
C
![Page 28: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/28.jpg)
Infrastructure components – Distributed Setup
EmbeddedEventStore
TrackingEventProcessor
DistributedCommandBus
![Page 29: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/29.jpg)
Separate infrastructure from business logic
A
D
B
E
C
![Page 30: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/30.jpg)
Separate infrastructure from business logic
A
D
B
E
C
![Page 31: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/31.jpg)
Infrastructure components – Clustered Setup
EmbeddedEventStore
ClusteringEventProcessor
DistributedCommandBus
![Page 32: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/32.jpg)
CQRS Based Architecture
![Page 33: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/33.jpg)
Axon – Command Bus API
commandBus.dispatch(commandMessage, new VoidCallback() { @Override public void onSuccess() { ... } @Override public void onFailure(Throwable cause) { ... } });
@CommandHandler public void handle(CreateToDoItemCommand command) { // handle command }
![Page 34: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/34.jpg)
Axon – Event Bus API
@EventHandler public void onEvent(ToDoItemCompletedEvent event) { // handle event }
eventBus.publish(asEventMessage(new ToDoItemCompletedEvent(“todo1”)));
![Page 35: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/35.jpg)
CQRS Based Architecture
class AggregateLifecycle @CommandHandler @EventSourcingHandler
![Page 36: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/36.jpg)
Event Sourcing
![Page 37: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/37.jpg)
Event Sourcing
ID OrderID Product Count 1 1 Deluxe Chair 1
2 1 ... ...
vs
OrderItems
Seq# Event 0 OrderCreatedEvent
1 ItemAddedEvent (2x Deluxe Chair - € 399)
2 ItemRemovedEvent (1x Deluxe Chair - € 399)
3 OrderConfirmed
4 OrderCancelledByUserEvent
5 ReturnShipmentReceived
ID Status 1 Return shipment rcvd
Orders
![Page 38: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/38.jpg)
Event Logs
![Page 39: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/39.jpg)
CQRS Based Architecture
interface EventStore class EmbeddedEventStore class JpaEventStorageEngine class JdbcEventStorageEngine class MongoEventStorageEngine
class TrackingEventProcessor class SubscribingEventProcessor
![Page 40: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/40.jpg)
Summarizing
![Page 41: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/41.jpg)
Axon Framework – Some cases
Finance
Process automation in a top 50 bank Trading engine for ETF (index trackers) trading On-line payment processing
Gaming & Betting
On-line bridge platform (bridgebig.com) On-line casino (casumo.com) Price calculation at large betting office
Healthcare
Electronic Medical Record for the Geriatric Healthcare Tracking and Tracing of equipment for dental implants
Transportation & Logistics
Optimizing aircraft movement at several large airports
![Page 42: Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions with Axon Framework Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo,](https://reader033.fdocuments.us/reader033/viewer/2022050523/5fa6a1c199b3d722ff0a9610/html5/thumbnails/42.jpg)
Getting started...
Download: axonframework.org/download
or: maven central repository
Code: github.com/AxonFramework
Help: [email protected]
or: @axonframework