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
Nieder mit dem Spaghetti Code durch Statemachines
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Nicolas Byl
April 25, 2018
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nieder mit dem Spaghetti Code durch Statemachines
Nicolas Byl
April 25, 2018
More Decks by Nicolas Byl
See All by Nicolas Byl
Platform Engineering ❤️ Developer Experience
nbyl
0
62
Die Flucht aus der Prototypen-Hölle
nbyl
0
61
Lean Prototyping for Industrial-IoT Projects
nbyl
0
77
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
120
Securing your software supply chain
nbyl
0
400
Keeping-Up-WithUpstream.pdf
nbyl
0
200
Dr. Kube und der Helm - Anatomie einer CD-Pipeline
nbyl
0
160
Securing the "other" supply chain
nbyl
0
330
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
220
Other Decks in Technology
See All in Technology
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
130
AWS ネットワーク構築でハマった(ハマりかけた) 5選とそこから得た教訓
nagisa53
4
260
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.4k
Goでデータパイプラインを作ろう
sansantech
PRO
1
500
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
350
『三匹の子ぶた』から学ぶネットワークセキュリティの昔と今 / Network Security: Then and Now Through the Lens of The Three Little Pigs
nttcom
1
6.2k
システム思考で問題に対処する
yussak
0
330
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
5
1.9k
私がブラウザを自作したくなった理由
supurazako
1
260
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
220
TypeScript入門 2026
recruitengineers
PRO
3
680
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
6
1.6k
Featured
See All Featured
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
870
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
470
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
390
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
210
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
470
My Coaching Mixtape
mlcsv
0
240
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
A designer walks into a library…
pauljervisheath
211
24k
The SEO identity crisis: Don't let AI make you average
varn
0
530
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
300
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
490
Embracing the Ebb and Flow
colly
88
5.1k
Transcript
1 NIEDER MIT DEM SPAGHETTI CODE DURCH STATEMACHINES JAX 2018
Nicolas Byl, codecentric AG
2 . 1 EINLEITUNG
None
2 . 2
2 . 3 2 . 4 Wer hat bereits eine
State Machine implementiert?
if (order.getState() == State.COMMISSIONED) { order.setState(State.SHIPPED); order.save(); }
2 . 5 2 . 6 Nochmal: Wer hat bereits
eine State Machine implementiert?
3 . 1 STATE MACHINES
3 . 2 Ein Beispiel Downloading docker pull Blocked docker
create Image is pulled Dependencies satisfied Pending Starting docker start Ready Throttling policy LivenessProbe reports its first OK Failed Time-out
3 . 3 Zustandsänderungen
3 . 4 DISTRIBUTED BALL OF MUD https://commons.wikimedia.org/wiki/File:Taylor%27s_Dorodango_cropped.jpg
3 . 5 Zustandsänderungen konzentrieren
4 . 1 SPRING STATE MACHINES
4 . 2 Spring State Machines State Machine Library Spring
Integration Event-basiert
4 . 3 Integration <dependencies> <dependency> <groupId>org.springframework.statemachine</groupId> <artifactId>spring-statemachine-core</artifactId> <version>1.2.8.RELEASE</version> </dependency>
</dependencies>
4 . 4 Konfiguration @Configuration @EnableStateMachine public class StateMachineConfig extends
EnumStateMachineConfigurerAda @Override public void configure(StateMachineStateConfigurer<CheckStatus, Ch states .withStates() .initial(CheckStatus.Initializing) .states(EnumSet.allOf(CheckStatus.class)); }
4 . 5 Konfiguration (2) @Override public void configure(StateMachineTransitionConfigurer<CheckStatu transitions
.withExternal() .source(CheckStatus.Initializing).target(CheckStatus. .and() .withExternal() .source(CheckStatus.Initializing).target(CheckStatus. .and() [...]; } }
4 . 6 Events auslösen stateMachine.sendEvent(CheckEvents.succeeded);
4 . 7 Zustandsänderungen überwachen @WithStateMachine static class MyBean {
@OnTransition(target = CheckStatus.Operational) void enteredOperational() { } @OnStateChanged public void checkStatusChanged(StateContext<CheckStatus, CheckEve } }
5 . 1 DEMO TIME
5 . 2 Monitoring Demo Monitoring von lokalen Dateien Alarmierung
wenn zwei Checks in Folge fehlschlagen
5 . 3 State Machine
5 . 4 Demo Project https://github.com/nbyl/spring-state-machine-demo
6 . 1 SPRING STATE MACHINE
6 . 2 Advanced Features Verteilte State Machines mittels Zookeeper
Scoping Security State Persistence
7 . 1 THE END Copyright 2018