“Heya, I’m Dominik, the software
engineer @ The Best Software
Company. We have one big project
that have some problems”
Dominik
The Best Software Company
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 3
Slide 3 text
The Best Software
Company
Damian Dziaduch - Reliable communication - PHPers Summit 2023
- Typical company
- Huge monolith
- Big ball of mud architecture
- Features are taking longer and longer
- More and more bugs
Slide 4
Slide 4 text
“We read few books about micro
services, we have decided that we
are going fully into micro services.”
Dominik
The Best Software Company
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 5
Slide 5 text
Step 3
Network as a
spine
Step 4
Problems?
Step 2
Microservices
Damian Dziaduch - Reliable communication - PHPers Summit 2023
The path
Step 1
Monolith
Slide 6
Slide 6 text
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 7
Slide 7 text
“The data is stored and the event is
sent. Both must succeed. All or
nothing.”
Dominik
The Best Software Company
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 8
Slide 8 text
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 9
Slide 9 text
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 10
Slide 10 text
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Slide 11
Slide 11 text
Damian Dziaduch - Reliable communication - PHPers Summit 2023
> Applies to the event producers
> Atomicity - all or nothing
> Simple command handlers
> Sending events is decoupled
> Faster command handlers
> No event is sent, just stored
> Infinite retries
> History of sent events
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Outbox - benefits
Slide 16
Slide 16 text
> At least once delivery
> Receivers must be ready for this
> Inbox pattern for the rescue
> A relay is required
> Periodically pools events from the outbox
> Use log tailing to retrieve events
> NoSQL solution is more complex
> Complex indexing
> Complex querying
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Outbox - drawbacks
Slide 17
Slide 17 text
> Your code is doing critical business logic (core domain)
> The event broker is not reliable
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Outbox - when to use it
Slide 18
Slide 18 text
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Inbox
Slide 19
Slide 19 text
> Applies only to the event consumers
> Event must have unique ID
> Event must be stored
> They could be stored forever or for some time
> Not needed when your application is already idempotent
> Product can be created once
> Once it is created, next tries will be discarded
> History of received events
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Inbox summary
> Outbox
> Atomicity - all or nothing
> At least once delivery
> Infinite retries
> History of sent event
> Inbox
> Guarantees that event is processed only once
> History of processed events
Damian Dziaduch - Reliable communication - PHPers Summit 2023
Summary
Slide 22
Slide 22 text
> Remote work
> Flexible work day
> Stock options
> Learning budget
> Well-being budget
> Paid days off for contractors
> MacBooks
Damian Dziaduch - Reliable communication - PHPers Summit 2023
We are hiring! jobs.printify.com