Tom Insam

Faking a message queue

Right. Here's an idea I want someone else to build, because I'm too lazy/busy. I want a Stomp interface to mysql.

Let me explain. There are lots of reasons you might want a message queue architecture in your new web application. You want long-running background processes, or you want to fan out changes to lots of users without tying up the web server process. Or you want to make calls to an API somewhere, again without tying up an expensive web server process. It's a lot easier to build this stuff in from the beginning than to try to work out later which bits of your application flow don't need to happen before the web page is returned to the user.

At the same time, it's a tiny new web site. You don't want to have to run a message queue just yet, so you want to fake it - write tasks into a database table, and have a long-running daemon loop forever, pulling out rows in order and doing them. Almost as good as a real message queue for small volumes of messages, and a lot cheaper. So what I want is a way of doing this that has the same API as a real message queue, so that when you cut over, you don't have to change any code, everything just gets more responsive. Yay!

Right. Now someone do it. Let me know when you're done.