$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Buses
Search
Magnus Nordlander
October 19, 2015
Programming
0
79
Buses
Command buses and Event buses
Magnus Nordlander
October 19, 2015
Tweet
Share
More Decks by Magnus Nordlander
See All by Magnus Nordlander
How Fervo builds web apps
magnusnordlander
0
140
Monitoring your Application
magnusnordlander
0
490
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
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.3k
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
350
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
愛される翻訳の秘訣
kishikawakatsumi
3
330
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
230
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
130
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.3k
認証・認可の基本を学ぼう前編
kouyuume
0
260
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
270
開発に寄りそう自動テストの実現
goyoki
2
1.2k
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
440
GISエンジニアから見たLINKSデータ
nokonoko1203
0
170
Featured
See All Featured
Odyssey Design
rkendrick25
PRO
0
420
エンジニアに許された特別な時間の終わり
watany
105
220k
Are puppies a ranking factor?
jonoalderson
0
2.3k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
110
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
83
Utilizing Notion as your number one productivity tool
mfonobong
2
180
Side Projects
sachag
455
43k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Between Models and Reality
mayunak
0
130
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Fireside Chat
paigeccino
41
3.7k
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?