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
Buses
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Magnus Nordlander
October 19, 2015
Programming
80
0
Share
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
140
Monitoring your Application
magnusnordlander
0
510
Git Internals for PHP Developers
magnusnordlander
0
210
HttpFoundation – An excursion in a Symfony2 component
magnusnordlander
1
110
The GIt object model and using Gittern
magnusnordlander
2
1.5k
Other Decks in Programming
See All in Programming
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
310
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
390
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
110
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
250
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
600
Back to the roots of date
jinroq
0
630
Making the RBS Parser Faster
soutaro
0
640
의존성 주입과 모듈화
fornewid
0
160
空間オーディオの活用
objectiveaudio
0
110
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
270
Road to RubyKaigi: Play Hard(ware)
makicamel
1
520
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7k
Chasing Engaging Ingredients in Design
codingconduct
0
180
The Cult of Friendly URLs
andyhume
79
6.9k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Mobile First: as difficult as doing things right
swwweet
225
10k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
380
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
How to make the Groovebox
asonas
2
2.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Odyssey Design
rkendrick25
PRO
2
610
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?