Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Nieder mit dem Spaghetti Code durch Statemachines
Search
Nicolas Byl
April 25, 2018
Technology
170
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
Transcript
26 slides
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
More Decks by Nicolas Byl
See All by Nicolas Byl
Platform Engineering ❤️ Developer Experience
nbyl
0
74
Die Flucht aus der Prototypen-Hölle
nbyl
0
68
Lean Prototyping for Industrial-IoT Projects
nbyl
0
89
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
130
Securing your software supply chain
nbyl
0
420
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
350
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
230
Other Decks in Technology
See All in Technology
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
2
1.4k
さようならSSH鍵、こんにちはゼロトラスト ― AIフレンドリーで快適な自宅鯖SSH
atalie2m
14
7.2k
飯から始まるデータエンジニア
sansantech
PRO
0
110
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
380
gem install とrequire のむこうがわ
ydah
0
240
設計手法を「道具」として使いこなすために
a_suenami
7
1.4k
こんなに変わった! AWSネットワークの常識
shotashiratori
16
11k
アラートを見直していたら営業組織への理解にちょっとだけ繋がった話
z63d
1
210
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
440
エンタープライズIAMについて - ID・権限をどう統制するか
oidfj
1
250
re:Inventを楽しむために、 1日1つ「これが楽しみ」を決めよう
beli68
0
120
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
560
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.9k
Raft: Consensus for Rubyists
vanstee
143
7.9k
What's in a price? How to price your products and services
michaelherold
247
13k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
630
First, design no harm
axbom
PRO
2
1.4k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
820
The browser strikes back
jonoalderson
0
2k
GitHub's CSS Performance
jonrohan
1033
470k
Abbi's Birthday
coloredviolet
5
11k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
570