Using your Database as a Queue? Good or bad idea?
Video Statistics and Information
Channel: CodeOpinion
Views: 9,888
Rating: undefined out of 5
Keywords: Database as a Queue, software architecture, software design, software architect, .net, message queues, kafka, event bus, event driven architecture, azure service bus, rabbitmq, distributed transactions, service bus, message queue, message queuing, database as a queue antipattern, activemq, postgresql, postgres, postgres queue, mysql queue, oracle queue, sqlite queue, sqs, postgresql queue, queue for update, postgres queueing
Id: DOaDpHh1FsQ
Channel Id: undefined
Length: 9min 31sec (571 seconds)
Published: Thu Apr 20 2023
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
I've read a lot of software books and I can tell you, without having watched the video yet, the only answer to every architecture video that ever comes to this sub with a question as the title...
It depends.
Good idea for low volume with few concurrent writes and infrequent polling.
Bad idea for anything where you aren't in control of those variables and their scale.
Edit:
One situation where this pattern shines is when you have an asynchronous workflow where a user kicks off a job and a process needs to call several APIs, some which may be intermittently unreachable, records are created in another system, but the next part of the process can't happen until actions are taken on the other end.
You may have 20 queue items per week and since it's all table backed it's easy to build management interfaces to the queue to restart jobs and see current status and process details.
2 cases I can think of where a DB table is preferable to a broker: 1 you need to be able to query what is in the queue at any point. 2 outboxing. Ok that’s only 1 and a half cases, outbox uses both.