Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LEVELUP 2015 - Enterprise software schaalbaar m...
Search
Michiel Overeem
November 26, 2015
Technology
0
260
LEVELUP 2015 - Enterprise software schaalbaar maken met Service Fabric
hoe AFAS zijn next gen ERP platform ontwikkelt
Michiel Overeem
November 26, 2015
Tweet
Share
More Decks by Michiel Overeem
See All by Michiel Overeem
Reminiscing a crazy journey: building an event sourced ERP system
overeemm
0
120
EventSourcing.Live 2021 - A system with thousands of event types
overeemm
0
330
EventSourcing.Live 2021 - Event system evolution - A Scientific Study on Event Sourcing, Lessons from Industry
overeemm
0
310
DDDVienna - 103 years of event sourcing experience
overeemm
0
410
DDDVienna - Applying event sourcing and CQRS in a large ERP system
overeemm
1
1.2k
Landelijk Architectuur Congres - The dark side of event sourcing: managing data conversion
overeemm
0
340
Dutch .NET Group Meetup - Building an event sourced system in .NET
overeemm
0
460
Drukwerkdeal.nl Developer Meetup - Event Sourcing After Launch
overeemm
0
250
DDDEurope 2018 - Event Sourcing After Launch
overeemm
5
2.5k
Other Decks in Technology
See All in Technology
CDKのコードを書く環境を作りました with Amazon Q
nobuhitomorioka
1
150
Goで作って学ぶWebSocket
ryuichi1208
3
2.5k
AI Agent時代なのでAWSのLLMs.txtが欲しい!
watany
2
170
Visualize, Visualize, Visualize and rclone
tomoaki0705
9
77k
AWSを活用したIoTにおけるセキュリティ対策のご紹介
kwskyk
0
300
速くて安いWebサイトを作る
nishiharatsubasa
15
15k
利用終了したドメイン名の最強終活〜観測環境を育てて、分析・供養している件〜 / The Ultimate End-of-Life Preparation for Discontinued Domain Names
nttcom
2
360
わたしがEMとして入社した「最初の100日」の過ごし方 / EMConfJp2025
daiksy
13
4.1k
Raycast Favorites × Script Command で実現するお手軽情報チェック
smasato
1
130
分解して理解する Aspire
nenonaninu
2
760
AWSではじめる Web APIテスト実践ガイド / A practical guide to testing Web APIs on AWS
yokawasa
5
260
(機械学習システムでも) SLO から始める信頼性構築 - ゆる SRE#9 2025/02/21
daigo0927
0
250
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Code Review Best Practice
trishagee
67
18k
Automating Front-end Workflow
addyosmani
1368
200k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
How to Ace a Technical Interview
jacobian
276
23k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Scaling GitHub
holman
459
140k
Documentation Writing (for coders)
carmenintech
67
4.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
What's in a price? How to price your products and services
michaelherold
244
12k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Transcript
Enterprise software schaalbaar maken met Service Fabric hoe AFAS zijn
next gen ERP platform ontwikkelt
360+ medewerkers (4 locaties) 10.000 klanten (bedrijven) 1.500.000 gebruikers 80
miljoen euro omzet (2014) AFAS Software
AFAS Profit Maandelijks 1.500.000 loonstroken HRM, CRM, financieel, order management,
project management, workflow, ...
AFAS Online 1780 cores, 25 TB RAM, 180 TB SSD
storage 10.000 concurrent RDP gebruikers 200.000 unieke gebruikers per maand 1.500.000 API calls per dag
Software kun je definiëren in plaats van programmeren.
Modelleer het bedrijf met zijn processen
Sla het model op in een definitie
Lees de definitie in een generator
Lever de resulterende applicatie uit
None
client command-systeem query-systeem event bus
Command public class CreateArticleCommand : Command { public Guid ArticleId
{ get; set; } public string Description { get; set; } public decimal Price { get; set; } } Event public class ArticleCreatedEvent : Event { public Guid ArticleId { get; set; } public string Description { get; set; } public decimal Price { get; set; } } Query public class GetArticleQuery : Query { public Guid ArticleId { get; set; } }
client query-systeem event bus command-systeem
AggregateRoot - Handle public void Handle(CreateArticleCommand command) { if(command.Price <=
0) { throw new CommandValidationException("Price should be greater than 0."); } if(string.IsNullOrEmpty(command.Description) || command.Description.Length > 20) { throw new CommandValidationException("Description is mandatory, " + "and cannot be longer than 20 characters."); } RaiseEvent(new ArticleCreatedEvent(command.ArticleId, command.Description, command.Price)); } AggregateRoot - Apply private void Apply(ArticleCreatedEvent @event) { _saleable = true; _price = @event.Price; }
client query-systeem event bus
CommandHandler private void Handle(CreateArticleCommand command) { Repository.ExecuteOn<ArticleAggregateRoot>(command.ArticleId, command); } AggregateRootRepository
- InMemory public virtual async Task ExecuteOn<T>(Guid aggregateId, Command command) where T: AggregateRoot { T aggregateRoot = LoadAggregateRoot<T>(aggregateId); aggregateRoot.Handle(command); await SaveAndDispatchEvents(aggregateRoot); }
1 3 7 4 8 2 8 6 5 1
3 1 4 6 2 7 6 5 4 8 3 7 2 5
“Actors are isolated, single-threaded components that encapsulate both state and
behavior.”
1 3 7 4 8 2 8 6 5 1
3 1 4 6 2 7 6 5 4 8 3 7 2 5
service systeem reliable collections communicatie actors service API service systeem
reliable collections communicatie service API
client query-systeem event bus
AggregateRootRepository - InMemory public virtual async Task ExecuteOn<T>(Guid aggregateId, Command
command) where T: AggregateRoot { T aggregateRoot = LoadAggregateRoot<T>(aggregateId); aggregateRoot.Handle(command); await SaveAndDispatchEvents(aggregateRoot); } AggregateRootRepository – Service Fabric public override async Task ExecuteOn<T>(Guid aggregateId, Command command) { var actor = ActorProxy.Create<IAggregateRootActor>(new ActorId(aggregateId), "App"); await actor.ExecuteOn(typeof(T).AssemblyQualifiedName, command.ToJson()); }
AggregateRootActor public async Task ExecuteOn(string aggregateRootType, string commandJson) { var
aggregateRoot = LoadAggregateRoot(aggregateRootType); var command = Deserialize(commandJson); aggregateRoot.Handle(command); await SaveAndDispatchEvents(aggregateRoot); }
één Stateless Actor Type Range partitions voor load balancing Actor
Id is het Id van de AggregateRoot
client command-systeem event bus query-systeem
QueryModelBuilder private void Handle(ArticleCreatedEvent @event) { Repository.Add(@event.ArticleId, new JObject( new
JProperty("Article", @event.ArticleId), new JProperty("Description", @event.Description), new JProperty("Price", @event.Price))); } QueryHandler private JObject Handle(GetArticleQuery query) { return Repository.Get(query.ArticleId); }
client command-systeem event bus
client command-systeem event bus
QueryModelBuilder Service public async Task Handle(string eventJson) { var queue
= await StateManager.GetOrAddAsync<IReliableQueue<string>>("qmbQueue"); using(ITransaction tx = StateManager.CreateTransaction()) { await queue.EnqueueAsync(tx, eventJson); await tx.CommitAsync(); } }
QueryModelBuilder Service protected override async Task RunAsync(CancellationToken cancellationToken) { var
queue = await StateManager.GetOrAddAsync<IReliableQueue<string>>("qmbQueue"); while(true) { using(ITransaction tx = StateManager.CreateTransaction()) { ConditionalResult<string> dequeueReply = await queue.TryDequeueAsync(tx); if(dequeueReply.HasValue) { string message = dequeueReply.Value; _queryModelBuilder.Handle(Deserialize(message)); await tx.CommitAsync(); } } } }
één Stateful Service Type Named partitions voor load balancing Partition
name is het type van de QueryModelBuilder
None
Voor vragen, discussie etc:
[email protected]
- @michielovereem - https://linkedin.com/in/movereem CQRS
+ Service Fabric • Sluit ontzettend goed aan bij onze architectuur. • Betrouwbaarheid, schaalbaarheid en onderhoudsgemak. • Portable cloud hosting is mogelijk. https://github.com/AFASSoftware/CQRS-Microservices