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
Buses
Search
Magnus Nordlander
October 19, 2015
Programming
86
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Buses
Command buses and Event buses
Magnus Nordlander
October 19, 2015
More Decks by Magnus Nordlander
See All by Magnus Nordlander
How Fervo builds web apps
magnusnordlander
0
150
Monitoring your Application
magnusnordlander
0
540
Git Internals for PHP Developers
magnusnordlander
0
210
HttpFoundation – An excursion in a Symfony2 component
magnusnordlander
1
120
The GIt object model and using Gittern
magnusnordlander
2
1.6k
Other Decks in Programming
See All in Programming
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
Jetpack Compose Mechanisms
skydoves
3
820
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
740
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
500
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
JIS keyboard support in Omarchy
lef237
0
120
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
Fireside Chat
paigeccino
43
4.1k
Site-Speed That Sticks
csswizardry
13
1.6k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Technical Leadership for Architectural Decision Making
baasie
3
600
Done Done
chrislema
187
17k
How GitHub (no longer) Works
holman
316
150k
Chasing Engaging Ingredients in Design
codingconduct
0
360
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
780
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Transcript
Buses Command buses and Event buses
Magnus Nordlander • PHP consultant specializing in Symfony • Working
at Fervo
Hybrid Bus RTB by Kecko https://www.flickr.com/photos/kecko/8217510887/
Foro Romano by Bert Kaufmann https://www.flickr.com/photos/22746515@N02/8043630550/
The three degrees of doing • Do it yourself •
Ask someone else to do it • Command it be done
Emperor Trajan at Tower Hill by DncnH https://www.flickr.com/photos/duncanh1/9548613224/
Commands • A command is a message which is imperative
in nature • ChangeUserPassword • SendWelcomeEmail
Commands • Always handled by exactly one handler • Task-oriented
• Never returns a value • Required for Command/Query Separation
Command handlers • Immutable services • Handles exactly one command
type each • Only performs the "primary" task related to the event • Remember SRP and OCP
Command bus libs • SimpleBus • Tactician • Broadway
Demo
Why? • Models changes in domain language, capturing intent •
ChangePassword vs UpdateUser • Maps very well to a Task oriented UI
Why? • Reinforces Command-Query Responsibility Separation (CQRS) • Asking a
question should not change the answer • Clearly indicates which code changes system state
Restrictive? • Only performs primary task • No return value
Events
Events • Events are messages which are informational in nature
• UserPasswordWasChanged • WelcomeEmailWasSent
Events • Handled by zero or more listeners • Always
after-the-fact • Cannot change what has already happened
Event listener • Immutable service • Acts upon one type
of event and performs some action • Should be called every time a pertinent event is handled • No listener should be able to stop propagation
Event listener • Example: • WhenNewUserSignedUpSendWelcomeEmail
Event bus libs • SimpleBus • Broadway • Symfony EventDispatcher
• Laravel EventDispatcher • League EventEmitter
Demo
Connecting the dots • Command handlers can emit events •
Event subscribers can issue commands
Learning more • Matthias Noback has a series of excellent
blog posts • http://php-and-symfony.matthiasnoback.nl/tags/ command%20bus/ • Also has a Hexagonal Symfony workshop
Questions?