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
150
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
34
Die Flucht aus der Prototypen-Hölle
nbyl
0
50
Lean Prototyping for Industrial-IoT Projects
nbyl
0
69
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
110
Securing your software supply chain
nbyl
0
380
Keeping-Up-WithUpstream.pdf
nbyl
0
180
Dr. Kube und der Helm - Anatomie einer CD-Pipeline
nbyl
0
140
Securing the "other" supply chain
nbyl
0
300
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
200
Other Decks in Technology
See All in Technology
LINEアプリ開発のための Claude Code活用基盤の構築
lycorptech_jp
PRO
2
1.3k
JAWS DAYS 2026 CDP道場 事前説明会 / JAWS DAYS 2026 CDP Dojo briefing document
naospon
0
120
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
300
問い合わせ自動化の技術的挑戦
recruitengineers
PRO
2
130
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
360
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
44k
クラウド時代における一時権限取得
krrrr38
1
150
「使いにくい」も「運用疲れ」も卒業する UIデザイナーとエンジニアが創る持続可能な内製開発
nrinetcom
PRO
1
770
Snowflakeデータ基盤で挑むAI活用 〜4年間のDataOpsの基礎をもとに〜
kaz3284
1
330
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
5
1.1k
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
1.6k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.1k
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
Embracing the Ebb and Flow
colly
88
5k
Agile that works and the tools we love
rasmusluckow
331
21k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
200
The Pragmatic Product Professional
lauravandoore
37
7.2k
From π to Pie charts
rasagy
0
140
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
80
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
950
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
How to build a perfect <img>
jonoalderson
1
5.2k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
130
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