Emitting domain events with the outbox pattern
medium.com
medium.com
Massive understatement, one of the downsides that we've found with this pattern is the increase increase in binlog size for our database replication topology. One must be very careful with this pattern as to not create downstream issues with replication delay and such.
If taking advantage of this pattern in MySQL land, you should look into filtered replication to avoid this outbox table from being copied to every single replica. https://dev.mysql.com/doc/refman/5.7/en/change-replication-f...
There's also an extension for Quarkus (https://debezium.io/documentation/reference/stable/integrati...) which makes it very easy to implement the pattern in Java applications.
Disclaimer: I work on Debezium
Isn't this still inside an uncommitted transaction? What sort of bug would lead to an uncommitted record being deleted that was not a major bug in the database?
If the actual concern is that the record is deleted before the event is processed (not before it is sent as the article seems to be talking about), why not put foreign keys between the outbox and the users to either prevent that or make sure that both are deleted simultaneously?
You tell your client that the request failed and that's it, right? Or there's certainly other patterns designed to help avoid hard fails when the DB is down, but they seem orthogonal to this one, use them if they're helpful to your project, skip if not?