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
85
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
530
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
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
230
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
160
一人だけ、Kiroが静止する日
hideg
0
100
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
120
AIエージェント時代のコードレビューを設計する
nogu66
6
2.7k
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
160
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
670
自分的「カンファレンスの楽しみ方」
syumai
0
200
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
310
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
iOSDC2026登壇資料.pdf
riofujimon
0
150
AHC070解法紹介
eijirou
0
110
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
540
Joys of Absence: A Defence of Solitary Play
codingconduct
1
510
Building the Perfect Custom Keyboard
takai
2
870
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
We Have a Design System, Now What?
morganepeng
55
8.3k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
270
Writing Fast Ruby
sferik
630
63k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Side Projects
sachag
456
43k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
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?