Remix.run Logo
simonw 3 hours ago

> Oban allows you to insert and process jobs using only your database. You can insert the job to send a confirmation email in the same database transaction where you create the user. If one thing fails, everything is rolled back.

This is such a key feature. Lots of people will tell you that you shouldn't use a relational database as a worker queue, but they inevitably miss out on how important transactions are for this - it's really useful to be able to say "queue this work if the transaction commits, don't queue it if it fails".

Brandur Leach wrote a fantastic piece on this a few years ago: https://brandur.org/job-drain - describing how, even if you have a separate queue system, you should still feed it by logging queue tasks to a temporary database table that can be updated as part of those transactions.

nhumrich 2 hours ago | parent | next [-]

This is called the "transactional outbox pattern"!

simonw 2 hours ago | parent [-]

Good name! Looks like SeatGeek use that naming convention here: https://chairnerd.seatgeek.com/transactional-outbox-pattern/

This looks like a good definition too: https://www.milanjovanovic.tech/blog/outbox-pattern-for-reli...

sieep an hour ago | parent | prev [-]

Excellent point. Never thought of transactions in this way.