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
CQRS & Event Sourcing in OLX
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Łukasz Szymański
May 16, 2016
Programming
2k
7
Share
CQRS & Event Sourcing in OLX
Łukasz Szymański
May 16, 2016
More Decks by Łukasz Szymański
See All by Łukasz Szymański
Chain reaction of scaling up
szymanskilukasz
1
170
GraphQL Without Hype
szymanskilukasz
0
300
PHP's Not Dead - PHP7 In Practice
szymanskilukasz
10
43k
Text Retrieval
szymanskilukasz
0
210
OLX pod maską [PL]
szymanskilukasz
2
740
Other Decks in Programming
See All in Programming
事業会社でのセキュリティ長期インターンについて
masachikaura
1
270
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
120
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.2k
AIエージェントで業務改善してみた
taku271
0
540
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
550
AIを導入する前にやるべきこと
negima
2
260
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
590
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
180
JOAI2026 1st solution - heron0519 -
heron0519
0
150
10 Tips of AWS ~Gen AI on AWS~
licux
5
470
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
630
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
130
HDC tutorial
michielstock
2
630
How GitHub (no longer) Works
holman
316
150k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
350
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Building Applications with DynamoDB
mza
96
7k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
500
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
750
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Mind Mapping
helmedeiros
PRO
1
170
From π to Pie charts
rasagy
0
170
Transcript
CQRS Event Sourcing in OLX
CQRS
you can use a different model to update information than
the model you use to read information http://martinfowler.com/bliki/CQRS.html „
Command Query Responsibility Segregation
Command Query Responsibility Segregation
new AddCredits($userId, $amount); Command
Command new AddCredits($userId, $amount); Query new GetCredits($userId);
Event Sourcing
http://www.martinfowler.com/eaaDev/EventSourcing.html „ ensures that all changes to application state are
stored as a sequence of events
Not just can we query these events, we can also
use the event log to reconstruct past states http://www.martinfowler.com/eaaDev/EventSourcing.html „
Commad Event Model Event Storage Event Bus Command Handler Listeners
Read Storage Read Model Query
Commad Event Model Event Storage Event Bus Command Handler Listeners
Read Storage Read Model Query Critical section - use transaction
Commad Event Model Event Storage Event Bus Command Handler Listeners
Read Storage Read Model Query Critical section - use transaction Treat like temporary cache
That’s all
E-Wallet Credits; Invoices; Refunds
Wallet Credits Bonus Credits Refund Credits EXPIRE: X DAYS EXPIRE:
X DAYS EXPIRE: X DAYS INVOICE: YES/NO INVOICE: YES/NO INVOICE: YES/NO
Wallet Credits Bonus Credits Refund Credits EXPIRE: NEVER EXPIRE: 90
DAYS EXPIRE: 90 DAYS INVOICE: YES INVOICE: NO INVOICE: YES
Opis walleta w Polsce specyfikacja komenty enventy Commands
Add Wallet Credits Add Bonus Credits Add Refund Credits
Sub Wallet Credits Sub Bonus Credits Sub Refund Credits SubCredits
Opis walleta w Polsce specyfikacja komenty enventy Events
Wallet CreditsWasAdded Bonus CreditsWasAdded Refund CreditsWasAdded
Wallet CreditsWasSubtracted Bonus CreditsWasSubtracted Refund CreditsWasSubtracted
specyfikacja komenty enventy 7 commands 6 events
specyfikacja komenty enventy What about other stuff?
Commad Event Model Event Storage Event Bus Command Handler Listeners
Read Storage Read Model Query ?
Broadway komponenty Broadway https://github.com/qandidate-labs/broadway
Auditing log whether commands were successful or not
CommandHandling Provides the interface and a CommandHandler base class for
handling events
Domain domain abstractions of the Broadway framework including the aggregate
root, domain messages and domain events.
EventDispatcher The component provides an event dispatcher interface and a
simple implementation
EventHandling provides interfaces for an event bus and event listeners,
but also an implementation of a simple event bus and an event bus that will record published events
EventSourcing Provides base classes for event sourced aggregate roots and
entities, an event sourced repository implementation and testing helpers.
EventStore implementation based on doctrine/dbal to store events in a
relational database and an in-memory implementation that is useful for using in tests
ReadModel provides storage for your read models, a projector implementation
to create read models from event streams and testing helpers.
Repository Component providing an abstraction of the storage of aggregates.
Serializers provides a simple serializer interface and a serializer implementation
based on "handwritten" serializers
Commad Event Model Event Storage Event Bus Command Handler Listeners
Read Storage Read Model Query Broadway
Adding Wallet Credits
None
None
Credits Query
None
None
Lessons Learned
Small Steps Don’t try to CQRS/EventSource everything
Keep It Simple Avoid names like BonusCreditsWasSubtractedBecauseAdminHitSubtractBonusCr editsInAdminPanelEvent
Event Storming is not that easy as it sounds
It’s not RDBM Remember about analysts
Code changes Events handle changes to data, what about changes
to code?
Synchronize Remember about synchronizing read layer - especially after fail
Commad Event Model Event Storage Event Bus Command Handler Listeners
Read Storage Read Model Query Critical section - use transaction
Performance is not an issue - for this case
Timezone Agnostic Implement your own EventStore if you want timezone
aware records
Our Team
Paid Features
Next challenge Open source Paid Features libraries with Hexagonal Architecture
in mind
Team Lead PHP Dev Junior PHP Dev You ?
Łukasz Szymański Development Team Lead at @szymanskilukasz http://szymanskilukasz.github.io/ https://www.linkedin.com/in/szymanskilukasz https://twitter.com/szymanskilukasz