Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions...

Post on 10-Aug-2020

0 views 0 download

Transcript of Innovative solutions with Axon Framework - GOTO Conference · 2016-06-22 · Innovative solutions...

Innovative solutions with Axon Framework

Allard Buijze – abu@trifork.com – @allardbz At ANWB, Casumo, Gerimedica, Bridge Big

Four cases

Casumo

Online Casino

Games, Slot machines

High volumes

Auditing requirements

“Keep the spin button FAST!”

ANWB

Emergency assistance call-center

Task based system

3rd party integrations

Reporting requirements

Somewhat predictable peak-loads

Bridge Big

Online Bridge platform

Participants play for money

Large-scale tournaments

Elastically scalable

“Keep the game flowing smoothly”

Gerimedica

Electronic Medical Record

SaaS solution

Many integrations

High availability

Medical analysis on historic data

“Improve healthcare through technology and sharing knowledge”

What connects these cases?

?

Complex domain model

Complex environment

Value in history

Performance expectations

Avoid the Big ball of “Mud”

Source: http://www.sabisabi.com/images/DungBeetle-on-dung.JPG

Microservice Architecture

Source: http://martinfowler.com/articles/microservices.html

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

A Monolith is not (always) a Big Ball of Mud

St Breock Downs Monolith - www.cornwalls.co.uk

Desired evolution

1 – Build a monolith 2 – Extract components 3 – Extract more 4 – Scale as needed

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

Axon Framework – Core Principles

Message oriented

Events Commands

Location transparency

Separate infrastructure from business logic

Customizable

Configure to match your infrastructure, not vice versa

CQRS

CQRS Based Architecture

Command model Projections

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

Synchronizing models

Command model Projections

Events

CQRS Based Architecture

Separate infrastructure from business logic

A

D

B

E

C

Spring configuration - Simple

EmbeddedEventStore

TrackingEventProcessor

SimpleCommandBus

Separate infrastructure from business logic

A

D

B

E

C

Separate infrastructure from business logic

A

D

B

E

C

Infrastructure components – Distributed Setup

EmbeddedEventStore

TrackingEventProcessor

DistributedCommandBus

Separate infrastructure from business logic

A

D

B

E

C

Separate infrastructure from business logic

A

D

B

E

C

Infrastructure components – Clustered Setup

EmbeddedEventStore

ClusteringEventProcessor

DistributedCommandBus

CQRS Based Architecture

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 }

Axon – Event Bus API

@EventHandler public void onEvent(ToDoItemCompletedEvent event) { // handle event }

eventBus.publish(asEventMessage(new ToDoItemCompletedEvent(“todo1”)));

CQRS Based Architecture

class AggregateLifecycle @CommandHandler @EventSourcingHandler

Event Sourcing

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

Event Logs

CQRS Based Architecture

interface EventStore class EmbeddedEventStore class JpaEventStorageEngine class JdbcEventStorageEngine class MongoEventStorageEngine

class TrackingEventProcessor class SubscribingEventProcessor

Summarizing

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

Getting started...

Download: axonframework.org/download

or: maven central repository

Code: github.com/AxonFramework

Help: axonframework@googlegroups.com

or: @axonframework

More information

www.axonframework.org Allard Buijze <abu@trifork.com> – @allardbz @axonframework