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
Nicolas Byl
April 25, 2018
Technology
0
140
Nieder mit dem Spaghetti Code durch Statemachines
Nicolas Byl
April 25, 2018
Tweet
Share
More Decks by Nicolas Byl
See All by Nicolas Byl
Platform Engineering ❤️ Developer Experience
nbyl
0
2
Die Flucht aus der Prototypen-Hölle
nbyl
0
43
Lean Prototyping for Industrial-IoT Projects
nbyl
0
42
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
98
Securing your software supply chain
nbyl
0
360
Keeping-Up-WithUpstream.pdf
nbyl
0
160
Dr. Kube und der Helm - Anatomie einer CD-Pipeline
nbyl
0
120
Securing the "other" supply chain
nbyl
0
270
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
180
Other Decks in Technology
See All in Technology
定期的な価値提供だけじゃない、スクラムが導くチームの共創化 / 20251004 Naoki Takahashi
shift_evolve
PRO
3
330
JAZUG 15周年記念 × JAT「AI Agent開発者必見:"今"のOracle技術で拡張するAzure × OCIの共存アーキテクチャ」
shisyu_gaku
0
130
Goに育てられ開発者向けセキュリティ事業を立ち上げた僕が今向き合う、AI × セキュリティの最前線 / Go Conference 2025
flatt_security
0
350
Findy Team+のSOC2取得までの道のり
rvirus0817
0
380
Why React!?? Next.jsそしてReactを改めてイチから選ぶ
ypresto
10
4.5k
AI駆動開発を推進するためにサービス開発チームで 取り組んでいること
noayaoshiro
0
220
空間を設計する力を考える / 20251004 Naoki Takahashi
shift_evolve
PRO
3
410
いま注目しているデータエンジニアリングの論点
ikkimiyazaki
0
610
Large Vision Language Modelを用いた 文書画像データ化作業自動化の検証、運用 / shibuya_AI
sansan_randd
0
110
業務自動化プラットフォーム Google Agentspace に入門してみる #devio2025
maroon1st
0
200
SREとソフトウェア開発者の合同チームはどのようにS3のコストを削減したか?
muziyoshiz
1
100
Modern_Data_Stack最新動向クイズ_買収_AI_激動の2025年_.pdf
sagara
0
220
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Navigating Team Friction
lara
189
15k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
How GitHub (no longer) Works
holman
315
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
The World Runs on Bad Software
bkeepers
PRO
71
11k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
237
140k
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