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
89
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
Transcript
24 slides
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?
More Decks by Magnus Nordlander
See All by Magnus Nordlander
How Fervo builds web apps
magnusnordlander
0
150
Monitoring your Application
magnusnordlander
0
550
Git Internals for PHP Developers
magnusnordlander
0
220
HttpFoundation – An excursion in a Symfony2 component
magnusnordlander
1
130
The GIt object model and using Gittern
magnusnordlander
2
1.6k
Other Decks in Programming
See All in Programming
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
160
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
200
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
250
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
0
150
Distance field of Julia set
kinakomoti321
0
320
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
420
Crash Auto Pipelines
veronikapj
1
410
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
310
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
290
Coding with AI: How to trust the storyteller (AWS Community Day Adria, Ljubljana 2026)
slobodan
0
140
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
320
Featured
See All Featured
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
560
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
570
The Curious Case for Waylosing
cassininazir
1
610
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
Optimising Largest Contentful Paint
csswizardry
37
4k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
350
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
The Curse of the Amulet
leimatthew05
4
17k
BBQ
matthewcrist
90
10k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k