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
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
500
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
AIエージェントの設計で注意するべきポイント6選
har1101
6
3k
Vibe codingでおすすめの言語と開発手法
uyuki234
0
170
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
170
SQL Server 2025 LT
odashinsuke
0
140
Grafana:建立系統全知視角的捷徑
blueswen
0
280
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
180
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
210
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
170
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
4
690
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
340
Cap'n Webについて
yusukebe
0
160
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
780
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Done Done
chrislema
186
16k
Six Lessons from altMBA
skipperchong
29
4.1k
GitHub's CSS Performance
jonrohan
1032
470k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
280
So, you think you're a good person
axbom
PRO
1
1.9k
How STYLIGHT went responsive
nonsquared
100
6k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
41
Design in an AI World
tapps
0
120
New Earth Scene 8
popppiees
1
1.3k
Getting science done with accelerated Python computing platforms
jacobtomlinson
1
93
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?